ftp automation

ScriptFTP

The professional tool to automate FTP, SFTP, FTPS and schedule FTP batch jobs

The forum is now read only. Please, go to the the main ScriptFTP website if you need help.
Need help writing a script? Have any question about ScriptFTP?
In Microsoft FTP you can copy a file and change the name as you copy this way:

PUT LocalPathAndFile RemoteFile

Example:
PUT "C:\TestFile.txt" ".TestFile.txt"

and afterwards do RENAME ".TestFile.txt" "TestFile.txt"

How would this be done in ScriptFTP??
Hi there,

In ScriptFTP you can do so uploading the file and then rename it. For example:
Code: Select all# Connect to the FTP server OPENHOST("ftp.myhost.com", "myuser", "mypassword") # Change current remote directory. Files will be uploaded there CHDIR("/remote_destination_dir/") # Upload the file PUTFILE("C:\mydir\TestFile.txt") # Rename the remote file RENAMEFILE("TestFile.txt","newnamehere.txt")  
Hi,

This does not solve my problem. I have to upload the files with a "." (leading dot) so other
users(companies) do not recognize the file until I rename it without a leading dot.

So:
PUT "TestFile.txt" ".TestFile.txt"

After the file is uploadet:
RENAME ".TestFile.txt" "TestFile.txt"

Now the other company can see and download the "TestFile.txt"

Do I have to rename the file before I will upload it?
For that case you should rename the local file before uploading
it using EXEC. For example:
Code: Select all# Change the current local directory to the directory # where is located TestFile.txt LOCALCHDIR("C:\mydir") # Rename TestFile.txt using the DOS command rename EXEC("rename TestFile.txt .TestFile.txt") # Upload the file PUTFILE(".TestFile.txt") # Rename back .TestFile.txt to the original name EXEC("rename .TestFile.txt TestFile.txt")


Note that if you have to upload all the files in a local directory you
have to use the FOREACH loop and use variables inside the loop. If
this is the case let me know and I'll post an example.