i want to use tcl command fcopy to copy a file from windows host machine to a vm location. What I get is I need a inchannel and a outchannel. Here inchannel in the filestream and out channel is some kind of socket where a server is runing maybe. I am at bay regarding the server part and how the file will be saved from the socket in a vm path. Please guide with some resource link.
If you have two filenames (and both are currently visible, which depends on how things are mounted and which is totally out of baseline Tcl's control) use file copy. Otherwise, if you can arrange to get the contents of the file somehow (perhaps by using ssh hostaddress cat) then you use chan copy (which fcopy is the old name for).
set srcFD [open |[list ssh hostaddress cat "src/file.ext"] "r"]
set dstFD [open "dst/file.ext" "w"]
chan copy $srcFD $dstFD; # Or: fcopy $srcFD $dstFD
close $srcFD
close $dstFD
Related
I have a 4 GB text file, compressed to 1.4 GB zip file. I need to copy it over to a Windows secure server using RDP. I am able to copy small files but not this file. It takes 15 mins and then shows an error. Any tips?
You can try to copy it by using Drive Redirection. Here's a tutorial.
BTW, RDP cannot copy files larger than 2GB by using clipboard as said in Microsoft support
window rdp clipboard has limit of about 2GB if you want to copy paste more than 2 gb file then you can try any of these options.
split file into parts like 1 gb each part with help of winrar or any other software
Use any FTP software
map local pc drive for remote desktop session(for move or copy data)
File size doesn't matter - I copied folders through Remote Desktop connection with 30GB and more. While doing this I received "Unspecified error". The Problem is that you aren't allowed to use the clipboard again while you are copying. Doesn't matter if you use the clipboard for the same machine or from the remote machine. To summarize don't use Ctrl+C.
The madness is the error is delayed so you don't recognize quickly that those things relate.
format usb drive as ntfs
connect drive as local resource in remote desktop
NET USE X: \\TSCLIENT\F
robocopy c:\source x:\
net use X: /delete
If you are administrator, you can copy the files of any size over the network using Administrative Shares assuming that it is not purposefully disabled.
Enter the following url on your File Explorer and you will see all the files and folders on your C drive of that computer with read and write access:
\\computername\c$
right-click zip-file >> Properties >> Advanced >> Encrypt contents
open your one-drive or googledrive (if the secure server allows you) and park the encrypted file on there.
(you might have to one-drive space by signing up to a months 365)
https://support.microsoft.com/en-us/office/manage-your-onedrive-storage-and-limits-989fce19-ade6-4e2f-81fb-941eabefee28
I guess it would might be possible to use google datastore or something cloudy.
I have an FPGA setup that is connected a folder within /proc. I need to write to this file, but when I do this, the file size ends up being 0 and the file is not written, though no error is issued. Oddly this behavior does not occur with scp.
I can echo to file successfully: echo -ne "\000\000\000\000" > /proc/file
I can scp a file from a remote machine to /proc/file
I cannot copy a local file to it: cp localfile /proc/file
sftp also gives a 0 file size
My question is: what is different between cp and scp and sftp, probably at a pretty low level, that one works and the others don't.
I am trying to copy some zipped file from FTP to my local system (Windows). The transfer mode is default mode (ASCII). File is getting copied, I am not getting any problem during transfer.
The problem is that the size of file on FTP to the one which is copied on my local system is different.
FTP_file_size -> 12,812,085
Copied_file_size->12,551
Above files should be the same.
Now I am not able to figure it out what is wrong going with transfer.
For script which i am using please refer :
Why am I getting "File not found" errors with this Perl script using Net::FTP?
You have to use the binary (type "I") mode to transfer. Otherwise the FTP client translates line-ending characters to the local convention (on Windows: CR-LF) which would corrupt the ZIP format.
Scenario:
I have a process where many files are being copied (scp'd) to a DestinationServer by Host1, Host2, Host3, Host4 for example. Going to the same common directory: DestinationServer:/home/target. All the files are unique so no files will be overwritten. Host1-Host4 will have a cronjob that will launch their scp script to DestinationServer. The caveat is the Hosts are in different time zones, locations. So, they will finish at different times.
Need:
Since the files are being scp'd to Destination:/home/target, what is the best way to programmatically check when those scp's from the other Hosts are done??
Options:
My options are to programmatically do this either in perl or shell if possible.
What do I look for, what unix commands or perl modules could I use to help determine when the processes would finish? Any ideas, examples would be great! Thanks.
Use a Maildir kind of approach: copy all files to a temporary directory, then after the transfer is complete have the originating host perform a rename into the target directory via ssh. That way when a file appears in the target directory, you know that it is complete.
I suggest this because if you just scp files into the target directory and monitor the directory in whatever way, you cannot distinguish a complete transfer from an interrupted scp command or a network failure.
SGI::FAM, Sys::Gamin
Similar but alternative way to Jouni is to use semaphore files. Before scp-ing files originating host puts up semaphore-file and when finished, remove it. So you know, it's time.
In SQL I'm using xp_cmdShell to run FTP commands. I have no problem getting the list of files or copying files to the local server, but I want to compare copied file size to the original to make sure the get has been successful.
Any ideas on how to compare file sizes?
From a command prompt you can use the DOS File Compare command (fc). In your case you probably want to do a binary compare (there is no file size compare). I binary compare should work in your case.
Most DOS commands will return some code that let s you know the status.
http://www.computerhope.com/fchlp.htm
EDIT
Sorry, I read your question and realized you want to compare it against a file on the ftp server. I think this is a moot point since if ftp reports a successful file transfer there is no reason to compare (unless your source of comparison for not the ftp site). Does that make sense?
What you could do it use the FTP command ls command.
ftp> ls <filename>
where ftp> is the ftp prompt and not part of the command. This command gives you the file size in bytes. Then you need to use the dos command for the local file. Here is a StackOverflow question (and answer) about that.
Windows command for file size only?