Removing all content except for a particular folder
Hi all,
1) I want to remove and then re-upload new versions of everything on an SFTP server excluding a certain directory but I am running into trouble. Hoping someone can help...
2) Broken down by steps:
Step A)
I have an SFTP server with content that looks like this:
SFTP Server Content BEGINS ----------------------
/folder-1/
/folder-without-write-access/
/folder-3/
/file-1
/file-2
/file-3
SFTP Server Content ENDS ----------------------
What I want to do is remove all of the content from the SFTP server except for the single folder that I do not have write access to and therefore cannot remove. The content would then look like this:
SFTP Server Content BEGINS ----------------------
/folder-without-write-access/
SFTP Server Content ENDS ----------------------
Step B)
Then I want to upload new copies of everything except for the single folder that I do not have write access to and therefore can't overwrite. The content would then look like this:
SFTP Server Content BEGINS ----------------------
/folder-1/
/folder-without-write-access/
/folder-3/
/file-1
/file-2
/file-3
SFTP Server Content ENDS ----------------------
3) I want to accomplish this using the "winscp.com /script=SCRIPTNAME" command where the SCRIPTNAME file contains a list of commands for WinSCP to execute. (I have used this method before)
I normally issue a "rm *" command in the SCRIPTNAME file, but unfortunately I can't seem to find a way to get the "rm" command to remove everything except for ignoring a particular folder. If I do run "rm *" then I get an error (and WinSCP stops removing content) because WinSCP cannot remove that folder since I don't have write access to it.
I would just write individual "rm/rmdir" commands for each folder/file, but the number of folders/files and their actual names change except for the /folder-without-write-access/ folder whose name will stay the same.
I want to avoid:
- I want to avoid using the "WinSCP .NET assembly and COM library".
- I want to avoid having to generate the SCRIPTNAME file on the fly.
- I want to avoid relying on the synchronize command without first deleting the content. ie I definitely want to delete the content first.
Does anyone know how to fix this issue while still using the "winscp.com /script=SCRIPTNAME" method?
Thanks!
1) I want to remove and then re-upload new versions of everything on an SFTP server excluding a certain directory but I am running into trouble. Hoping someone can help...
2) Broken down by steps:
Step A)
I have an SFTP server with content that looks like this:
SFTP Server Content BEGINS ----------------------
/folder-1/
/folder-without-write-access/
/folder-3/
/file-1
/file-2
/file-3
SFTP Server Content ENDS ----------------------
What I want to do is remove all of the content from the SFTP server except for the single folder that I do not have write access to and therefore cannot remove. The content would then look like this:
SFTP Server Content BEGINS ----------------------
/folder-without-write-access/
SFTP Server Content ENDS ----------------------
Step B)
Then I want to upload new copies of everything except for the single folder that I do not have write access to and therefore can't overwrite. The content would then look like this:
SFTP Server Content BEGINS ----------------------
/folder-1/
/folder-without-write-access/
/folder-3/
/file-1
/file-2
/file-3
SFTP Server Content ENDS ----------------------
3) I want to accomplish this using the "winscp.com /script=SCRIPTNAME" command where the SCRIPTNAME file contains a list of commands for WinSCP to execute. (I have used this method before)
I normally issue a "rm *" command in the SCRIPTNAME file, but unfortunately I can't seem to find a way to get the "rm" command to remove everything except for ignoring a particular folder. If I do run "rm *" then I get an error (and WinSCP stops removing content) because WinSCP cannot remove that folder since I don't have write access to it.
I would just write individual "rm/rmdir" commands for each folder/file, but the number of folders/files and their actual names change except for the /folder-without-write-access/ folder whose name will stay the same.
I want to avoid:
- I want to avoid using the "WinSCP .NET assembly and COM library".
- I want to avoid having to generate the SCRIPTNAME file on the fly.
- I want to avoid relying on the synchronize command without first deleting the content. ie I definitely want to delete the content first.
Does anyone know how to fix this issue while still using the "winscp.com /script=SCRIPTNAME" method?
Thanks!