Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to find a simple way to do upload only modified files through FTP

Need to find a way to upload files to my server through FTP. But only the ones that have been modified. Is there a simple way of doing that? Command line ftp client or script is preferred. Thanks, Jonas.

like image 488
user52965 Avatar asked Jan 08 '09 15:01

user52965


People also ask

Which command is used to upload the files through FTP?

To upload file on FTP server use put command from FTP prompt.

Can you edit files via FTP?

You can use an FTP client to create and edit files for your website. This is an easier way to create and edit files compared to using the command line.

What is the command in FTP to upload multiple files?

Use the Multiple Put ( mput ) command with the wildcard character ( * ) to upload multiple files. Some FTP clients require you to manually acknowledge each file name when executing the mput command. This makes automating FTP scripts difficult because it requires you to be present when the script is executed.


1 Answers

The most reliable way would be to make md5 hashes of all the local files you care about and store it in a file. So the file will contain a list of filenames and their md5 hashes. Store that file on your ftp server. When you want to update the files on your ftp server, download the file containing the list, compare that against all your local files, and upload the files that have changed (or are new). That way you don't have to worry about archive bits, modified date, or looking at file sizes, the use of which can never be 100% reliable.

Using file sizes isn't reliable for the obvious reason - a file could change but have the same size. I'm not a fan of using the archive bit or modified date because either of those could be confused if you backup or restore your local directory with another backup program.

like image 101
mhenry1384 Avatar answered Oct 10 '22 03:10

mhenry1384