How can I add/delete files remotely in an FTP hookup?

The Situation Part 1:  I have a folder on a server containing files I have uploaded there via FTP. I need to delete certain files and add others on a regular basis. This is simple, straightforward, and I can do it easily using CuteFTP or Filezilla.

The Situation Part 2: Here's where the challenge is: I have 67 folders. I don't want to have to do this manually for all those folders.  I need a process that will do this:

Remove File "A" and "B" from Folder # 1
Add file "C" and "D"
Now, continue to do the same for the remaining 66 folders

It would be OK to use some type of "replace" function to get this done.

The Situation Part 3: Here's where it gets more complicated. The above explanation presents the simple picture. However, I will be working with three sets of two files. That is, for example, the files affected in folder 1 are:

File A + File B
File C + File D
File E + File F

They are to replaced with

File G + File H
File I + File J
File K + File L

The only solution I have come up with on my own so far is to use a macro in CuteFTP, which will take a LOOOONG time to build and if any minor tweaks come along, require rebuilding the whole thing, right?

One other thing:

I am NOT a tech.
I am NOT a tech.
I am NOT a tech.

I seem to get replies to my posts here which assume I am a wizard of coding. If I was, I wouldn't be posting here.

So, experts, any suggestions that are fairly simple to understand and easy to apply?

Thanks.
RadioGeorgeOwner/ProgrammerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

giltjrCommented:
When you want to replace "File A + File B" with "File G + File H" do file File and and File B still exist on the source computer?
0
RadioGeorgeOwner/ProgrammerAuthor Commented:
No.

The files that are being uploaded to replace the ones that are being deleted will all have new and different names.
0
giltjrCommented:
Are both systems the same OS?  If so, what is the OS?

I thinking instead of using FTP using file/directory synchronization.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

RadioGeorgeOwner/ProgrammerAuthor Commented:
I can only answer your question by explaining that I upload the files from my home computer to HostMonster, which is the company that hosts my web site. Hope this helps.
0
giltjrCommented:
Using what I would call "normal" file sync functions would be out of the question.

However you could try using WinSCP to use FTP/SFTP and try its directory sync function:  

     http://winscp.net/eng/docs/task_synchronize_full

You can read about it and see if it may work for you.
0
RadioGeorgeOwner/ProgrammerAuthor Commented:
This might work, but I'll have to see about writing a script, setting it up, etc. As I pointed out in my post, I am not a tech, and without a step-by-step simple example, I may not be able to dope this out on my own.

More to come...I think!
0
giltjrCommented:
First thing is to figure out which mode of synchronization you want:

Synchronize files
Mirror files
Synchronize timestamps (this one requires SFTP, which means it can't be used with just plain FTP).

Let me know and I see if I can create something for you.

Here are the options you can use from a script:

http://winscp.net/eng/docs/scriptcommand_synchronize
0
RadioGeorgeOwner/ProgrammerAuthor Commented:
Thanks for the continuing help! I appreciate it.

I'm a little uncertain about one important point:

Let me rephrase the process that I originally inquired about. I'm not sure that synchronization is what we're talking about. I will walk though a description....

There are 67 folders, one for 67 web pages, on the server for the web site.

In folder # 1, there are two mp3 files, named dogfood.mp3 and shavingcream.mp3. I need to replace those files with two other ones, perfume.mp3 and newcar.mp3.

In folder # 2, there are also two mp3 files, different names from those in folder 1, that need to replaced with two other ones, also of totally different names.

In folder # 3, there are also two mp3 files, different names from those in folder 1 or folder 2, that need to replaced with two other ones, also of totally different names.

Then, the changing of files like this continues for the remaining 64 folders.

Is "syncrhonization" the right process to do this?

ALSO: after 30 days, it is likely that I will have to do the same thing again, with all different file names.

Obviously, to do this all manually takes a lot of time.

Your thoughts, please?
0
giltjrCommented:
If you read the description in http://winscp.net/eng/docs/scriptcommand_synchronize of the modes you'll see that it will work, depending on which mode you choose.

On your computer you would have the same 67 folders and these will be the local folders/files.  You would delete the files you want removed from the remote computer, update the files you want updated, and add the files you want as new.

When you start the sync process any file that exist locally, but does not exist remotely will be copied to the remote computer.

Any file that does NOT exist locally, but exists remotely will be deleted.

Any file that exists in both local and remote will be replaced if the local file has a new time stamp.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RadioGeorgeOwner/ProgrammerAuthor Commented:
Let me set this up and give it a try and I will get back to you. May have to do it tomorrow, but will definitely follow up ASAP.
0
RadioGeorgeOwner/ProgrammerAuthor Commented:
OK, I have downloaded and set up WINSCP, after making sure that it will work with my hosted account. It works fine, and even imported my existing settings from other FTP programs, saving me some time. I have looked over the various commands and I think I have reached the limit of my technical understanding....meaning that I will need help in putting together what I'm guessing is a script to accomplish what I want to do.

1. I want to "tell" WINSCP to delete filenameone.mp3 from folders 1-67 without having to do so manually for each folder. (Note that filenameone.mp3 may not be in all of those folders.)

Then, I want to repeat the same process for other files, changing the name of the file to be deleted, such as filenametwo.mp3, filenamethree.mp3, and so on.

2. Next, I want to transfer newfilenameone.mp to SOME of the folders but not all, and again,  without having to do so manually for each folder.

And then I want to repeat the same process--transfer other files, into SOME designated folders but not all.

I don't understand how to write the instructions and then use them.

But it seems that your suggestion WILL work, if these scripts can be written and easily edited for the new names that will be used in this process on an ongoing basis.
0
giltjrCommented:
Using the directory/file sync function of WinSCP all you need to do is replicate the folder setup on YOUR computer and then delete/add files in the appropriate  folders on YOUR computer.  Then run sync process against every folder.

There is no simple easy way to have a single file on your computer and then have to copied to multiple variable folders on a remote computer.  That would requires a fairly complex program/script.  

You have to "mirror" exactly what you want on your local computer.

I think the script would look something like:

option batch abort
option confirm off
open sftp://user:password@remotehost.com
synchronize remote -delete localfolder1 remotefolder1
synchronize remote -delete localfolder2 remotefolder2
synchronize remote -delete localfolder3 remotefolder3
   .
   .
   .  
synchronize remote -delete localfolder67 remotefolder67
close

You can add -preview after "-delete" to to see what will happen, but nothing is actually done with the -preview option.
0
giltjrCommented:
WinSCP has an example of what you could do on their site:

http://winscp.net/eng/docs/script_synchronize_any_local_file

You can do what they have and execute the command 67 times, once for each folder pair, or put what I have in the script file and execute the command once.

Advantage my way, one command everything done.  Disadvantage, if you only have a couple directories/folders to do, mine does all of them.

Advantage their way, you can execute the command as many times needed for just the folders that need to be done.  So if you only changed 15 folders, you just execute their command 15 times with each folder pair.  Disadvantage their way, if you always update a 67 folders, you are doing 67 commands.
0
RadioGeorgeOwner/ProgrammerAuthor Commented:
Actually, the best solution is a combination of ALL of giltjr's comments here.

B instead of A? Yes, because, as I have experienced with other questions I've asked on EE, after emphasizing that "I am not a tech," part of the solution talks about scripting, And scripting is NOT something that a non-tech person knows how to do, or can learn to do very quickly. This is not meant as a slam, but my experience here seems to be that the experts just can't grasp the concept that probably most people who come here are NOT also experts. When someone says, "I am not a tech," that means NO TECHNICAL EXPERIENCE, and that an explanation is needed in as simple terms as possible.

However, the TOTAL solution came about thanks to the comments here. The suggestions led me to Sobolsoft's "Copy Files To Multiple Folder Locations Software," which is an easy to use program that saves me a LOT of time. Next, I downloaded WINSCP and looked at what can be done without having to do any scripting.

I then looked closely at CuteFTP Pro, which I own, and created a macro using just the recording of mouse and keyboard movements. A no-brainer, and definitely non-tech That creates a vbs file. The help guide in CuteFTP Pro explains that just OPENING that file by clicking on it will activate it to work, and that you can look at the file using Notepad.

BINGO!

I looked at the file in Notepad and saw the script, which does not use the alien-looking commands of other scrips. Part of what I saw was this:

MySite.RemoteRemove "/oldies/oldies1/spot2.mp3"
MySite.RemoteRemove "/oldies/oldies1/spot4.mp3"
MySite.RemoteRemove "/oldies/oldies2/spot1.mp3"

It was obvious and easy to see that (1) I could edit this file in Notepad simply by copying and pasting, and just changing folder and file names, and (2) this could be used as a template for other files.

So with these 3 programs, I can do exactly what I want to do with what amounts to a minimum of fuss and time--and I don't have to learn all that cryptic scripting stuff or pay someone to do it for me.  That works for me!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Networking

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.