Topic "Automatically create non-existing, nested folders from upload list."

Author Message
Registry_Editor

Guest


Good afternoon,

I'm trying to write a script to help me upload daily generated content to my server.

We're talking sometimes thousands of individual files each day, arranged like this:

example.com/docs/1/1/2/4/1/2/1/abc.txt
example.com/docs/1/2/2/3/1/3/1/def.txt
example.com/docs/1/1/1/2/3/2/1/4/1/ghi.txt
example.com/docs/1/3/2/1/1/2/3/3/2/3/1/1/jkl.txt


Mostly the folders already exist, however each time the files are generated there is the possibility for additional folders also to be generated. So I need my script to create the folder for each file if it does not already exist.

I made the foolish assumption that

Code:
put "C:\files\1\1\2\4\1\2\1\abc.txt" "example.com/docs/1/1/2/4/1/2/1/abc.txt"


would create any directory that didn't already exist and then upload the file to it. I don't see why this is not possible?

To recursively scan each directory to discover if a particular location already exists coupled with the requisite string manipulation to create said folders is starting to sound like an awful lot of work for what should surely be a simple, automatic operation.

Many thanks in advance,

RegEd
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
Cannot you use synchronization like this?

synchronize remote "C:\files\*" "/docs/"
Registry_Editor

Guest


martin wrote:
Cannot you use synchronization like this?

synchronize remote "C:\files\*" "/docs/"


Hi Martin, thanks for the response.

I currently do use the synchronize function but because the amount of files and folders is so large this takes a very long time (1-2 hours every day) and puts unnecessary load on the server. The file generator outputs a list of modified files each time it runs so I am trying to switch over to just uploading the modified files, rather than having to run synchronize for two hours every day.

Kind regards,

RegEd
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
OK, I see.

Though there's no other solution.

Either create the folders, or use the synchronization.
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License