Make WinSCP Better than NotePad++ Plugin FTP_Synchronize - ftp

Notepad++ FTP_Sync plugin works in this way:
It creates a cache directory (let's say cacheDir) and saves each FTP file like this:
cacheDir
- user#server.com
-- root
--- public_html
---- any_directory
----- any_file.*
- anotheruser#sameORotherserver.com
-- root
--- public_html
---- any_directory
----- any_file.*
- and so on...
Now if we open a file in WinSCP with Notepad++, it creates a temporary directory (something like scp45214) in Windows's temporary directory. If I open another file, it creates another new temporary directory (scpxxxx). So WinSCP doesn't maintain directory structure of FTP file under Window's temporary directory and also when I close WinSCP, it deletes all temporary (scpxxxx) directories...
Can we make WinSCP setting's work just like Notepad++ FTP_Sync plugin, so it can save and maintain directory structure of FTP file?

In WinSCP, go to the Storage page of Preferences dialog and check the option Append remote path to temporary path.
But this still won't prevent WinSCP from deleting local copies on exit.
Request for this is tracked here:
https://winscp.net/tracker/593
Alternatively, consider using the WinSCP feature Keep remote directory up to date:
With it, you can work on a local copy of the files and have the changes automatically mirrored on your server.

Related

Temporary tmp files created by Inno Setup in destination directory while installing

One of my customers reported that my app installer creates a temp file like is-XXXXX.tmp in the {app} directory, which are identified by anti-virus app as malware. The temp file would only live for a very short time, so I can't make a copy of it. My customer ask me to send him a copy of the temp file to make sure there is no harmful code inside it. Is there any method to copy this temp file out on installation? Thanks!
When Inno Setup is extracting files to their destination folders, it always does that first by storing them to the file names like is-XXXXX.tmp. Only then, it renames them to their actual file names.
So all those files are actually the files that your customer has in the destination folder once the installation completes.

Upload files to SFTP server and delete or archive the source files afterwards

I can't figure out a way to automatically sync files with an SFTP server that will do the following.
Syncs files from local PC to the SFTP
After upload deletes the file on the local PC and keeps SFTP file or
After upload moves the file that has been uploaded to another file for review.
I've tried using Ftpbox but it doesn't have the options.
WinSCP but couldn't find a script that would work.
Remote-Sync but didn't have the options.
If just want to move local files to a remote folder, use the WinSCP put command with the -delete switch.
A full Windows batch file would be like:
winscp.net /log=upload.log /command ^
"open sftp://username:password#example.com/ -hostkey=""ssh-rsa 2048 xxxxxxxxxxx...=""" ^
"put -delete C:\local\path\* /remote/path/" ^
"exit"
Have WinSCP generate the open command or even a complete batch file for you.
If you want to move/archive the local files to another local folder after the upload, it is more complicated.
See the official WinSCP example Moving local files to different location after successful upload.

Script Windows FTP move and rename file

basically i have a 2 files on my company FTP, i need the users to be able to click a script to swap the 2 files when they want.
FTP tree look like this:
/file1.vxml
/swap/file1.vxml
And here i need to connect to my ftp (on Windows), and rename /file1.vxml to /file2.vxml before moving then move it to /swap/ (to not overwrite /swap/file1.vxml). Then doing the opposite on /swap/file2.vxml and move it to the root.
i already have the connection :
open host.myhost.com
user myusername
mypassword
cd /
bye
but the thing i'm lacking is how to move and rename properly files on the ftp.
Use "REN" to rename files in FTP.
ftp> REN FileA FileB
Renaming and moving are the same thing essentially in FTP, you can move a file to a different folder by renaming it.
ftp> REN Here ../There
You'll probably have to download the first file back to your local server to save a copy, then rename the second file, and copy the file you downloaded back up to the server afterwards. I don't know of any FTP servers that support copying files within themselves.

In FTP, how do I copy a remote file to other directories

Using FTP commands I want to upload a large file once and then copy that file to many directories on the remote FTP server. All the copy commands seems to relate to copying from local to remote or the other way around.
Is there an FTP command to copy remote to remote?
are you trying to move the file? if yes, you can do it using rename command to move the file, as for copy i guess you still have to do the the get,send from local-remote way.
as for move command should be something like this
rename /oldpath/file2move.txt /newpath/file2move.txt
Basically just rename your file path that is infront of the file that you wish to move.
As far as I know, there is no such command available in FTP protocol. There are some extensions to SFTP protocol to do this (and, having SSH access, you can issue cp commands), but SFTP is not an FTP.

FTP Batch file moving remote files

I have an FTP batch file that uses DOS commands to pull down some files. After I'm done pulling the files down, I would like to move the files to an archive directory on the remote server. What FTP DOS commands do I use to accomplish this?
*I wasn't clear at first but this move has to take place on the remote server.
before you pull the files down, you can use the lcd (local cd) command to move to your archive directory and then pull them down directly there. you can then lcd back to your working directory.
otherwise you can perform the move in your bat after your ftp session is completed.
edit:
in the case that your archive server is remote, your best bet is to finish your ftp session and then perform the move in your .bat.
ftp has a rename command, that should move files remotely. I haven't tried it though

Resources