WinSCP - Do not synchronize subdirectories - winscp

I am writing winscp script in VBA to synchronize certain files from remote to local.
The code I am using is
""synchronize -filemask=""""*.xlsx"""" local C:\Users\xx\Desktop /JrnlDetailSFTPDirect""
There are three xlsx files: 14.xlsx, 12.xlsx, 13.xlsx. However, seems like it is running through all the files even though it is not synchronizing them. Besides, one folder under JrnlDetailSFTPDirect is also downloaded from remote, which is not expected.
Is it possible to avoid looping through all the files, just selecting those three files and downloading them?
Thanks

There are separate masks for files and folders.
To exclude all folders, use */ exclude mask:
synchronize -filemask="*.xlsx|*/" local C:\Users\xx\Desktop /JrnlDetailSFTPDirect
See How do I transfer (or synchronize) directory non-recursively?
I cannot tell anything regarding the other problem, as you didn't show us names of the files. Ideally, append a session log file to your question. Use /log switch like:
winscp.com /log=c:\writablepath\winscp.log /command ...

Related

How to rename multiple files in Linux?

I want to rename my files in linux from
sub-NDARINVKW1ALL48_ses-year0120161127_task-MID_run-20161127175734_bold.json
sub-NDARINVKW1ALL48_ses-year0120161127_task-MID_run-20161127175734_bold.nii.gz
sub-NDARINVKW1ALL48_ses-year0120161127_task-MID_run-20161127180331_bold.json
sub-NDARINVKW1ALL48_ses-year0120161127_task-MID_run-20161127180331_bold.nii.gz
sub-NDARINVKW1ALL48_ses-year0120161127_task-nBack_run-20161127173234_bold.json
sub-NDARINVKW1ALL48_ses-year0120161127_task-nBack_run-20161127173234_bold.nii.gz
sub-NDARINVKW1ALL48_ses-year0120161127_task-nBack_run-20161127173809_bold.json
sub-NDARINVKW1ALL48_ses-year0120161127_task-nBack_run-20161127173809_bold.nii.gz
sub-NDARINVKW1ALL48_ses-year0120161127_task-rest_run-20161127164822_bold.json
sub-NDARINVKW1ALL48_ses-year0120161127_task-rest_run-20161127164822_bold.nii.gz
to be
sub-NDARINVKW1ALL48_ses-year0120161127_task-MID_run-1_bold.json
sub-NDARINVKW1ALL48_ses-year0120161127_task-MID_run-1_bold.nii.gz
sub-NDARINVKW1ALL48_ses-year0120161127_task-MID_run-2_bold.json
sub-NDARINVKW1ALL48_ses-year0120161127_task-MID_run-2_bold.nii.gz
sub-NDARINVKW1ALL48_ses-year0120161127_task-nBack_run-1_bold.json
sub-NDARINVKW1ALL48_ses-year0120161127_task-nBack_run-1_bold.nii.gz
sub-NDARINVKW1ALL48_ses-year0120161127_task-nBack_run-2_bold.json
sub-NDARINVKW1ALL48_ses-year0120161127_task-nBack_run-2_bold.nii.gz
sub-NDARINVKW1ALL48_ses-year0120161127_task-rest_run-1_bold.json
sub-NDARINVKW1ALL48_ses-year0120161127_task-rest_run-1_bold.nii.gz
Can anyone help?
I have a list of similar files in different directories too. So, I want it to be a generic code that I can use, if possible.

Python cx_freeze Create dirs for included files in build

Is it possible to create dirs(folders) on cx_freeze build output, cause i include(include_files) many databases files and i want these to be in specific folder etc. I can take them easily from my folders.....
"include_files": ["databases/nations.txt","databases/newafrica.txt",
"databases/neweeurope.txt","databases/neweurope.txt","databases/newmeast.txt","graph.py",
"databases/newnamerica.txt","databases/plates.txt",
"databases/ACN/rigidA.txt","databases/ACN/rigidB.txt",
"databases/ACN/rigidC.txt","databases/ACN/rigidD.txt","databases/ACN/flexibleA.txt",
"databases/ACN/flexibleB.txt","databases/ACN/flexibleC.txt",
"databases/ACN/flexibleD.txt","alternates.xlsx",
but this will just copy all of them in exe build dir and its a mess.
Thanks in advance.
There are several ways you can go around solving the problem.
Method 1 - Using include_files
Rather than ask for each individual text file you could just put the file name in the setup script and leave out the individual text files. In your case it would be like this:
"include_files": ["databases"]
This would copy the entire databases folder with everything in it into you build folder.
Absolute file paths work as well.
If you are going to use the installer feature (bdist_msi) this is the method to use.
You can copy sub folders only using "include_files": ["databases/ACN"]
Method 2 - Manually
Ok it's rather un-pythonic but the one way to do it is to copy it manually into the build folder.
Method 3 - Using the os module
Much the same as method two it would copy the folder into your build folder but instead of coping it manually it would use Python. You also have the option of using additional Python features as well.
Hope I was helpful.

Applescript to javascript using node.js

I have an applescript that I would like to improve performance. Someone mentioned using node.js. I'm new to this and was wondering if the following is possible in node. I have a series of folders (say, Folder A, Folder B, etc.) and in these folders are subfolders named Main and Thumbnails. What my applescript does is pull all the files out of the Main folder into the root folder (Folder A, Folder B), then deletes the Main folder and the Thumbnails folder (files in Thumbnails are not needed).
Is this something that can be done in node.js?
Is this something that can be done in node.js?
Yes. But it is also something that can be done even simpler with a shell script.
But technically the answer to your question is: Yes.
Some APIs that you will most likely need to use:
https://nodejs.org/api/fs.html
https://nodejs.org/api/path.html
Some modules that can help you simplify concurrency:
https://www.npmjs.com/package/mz
https://www.npmjs.com/package/async
https://www.npmjs.com/package/bluebird

Use Log4View to a folder with zipped logfiles

I tried to use log4viewer for the first time. So my question is basic-level. It is possible to set Log4view to a folder, which has zipped log-files in it? And if yes, how can I configure Log4view correctly? I tried but can't find an example of to do that.
c:\Folder1\zippedLogfiles001.zip
c:\Folder1\zippedLogfiles002.zip
c:\Folder1\zippedLogfiles003.zip (up to 300 logfiles)
...
I heard it is possible that Log4view can read automatically from a folder, so that it doesn't need to unzip the log files manually.
Log4View doesn't work with zipped log files.
To open a log file with Log4View, it has to be a regular, uncompressed text or xml file.
Ulrich

Qt Installer framework - Copying files to location other than install directory

I know that, whatever data is placed in package/component dir/data, will be copied to the install directory. What I mean is if I have a binary, readme, license.txt inside package/component dir/data/myapp, package/component dir/data/readme, package/component dir/data/license.txt and if I choose my target installation dir to be “/opt/myfirstapp”, then inisde /opt/myfirstapp, I will have 3 files copied, myapp, readme, license.txt.
Having said that, I also have a “/usr” directory with in package/component dir/data/, however this is not the standard “/usr” which will be inside root “/”, it is just a replica. Now inside my replica “/usr” I have some directory hierarchy and some files, like /usr/bin/myapp, /usr/lib/libmyapp.so, /usr/share/icons” and many more, infact a lot. Now I want the replica “/usr” content to be copied to “/usr” (the original usr inside root folder). I should also make sure that I just add new contents to “/usr” (root /usr), but delete any existing content.
Question is clear, some files inside my data directory will have to go to target install dir, but some selected ones (for ex: /usr) will have to be copied to other paths. How do I achieve this.
Currently we have the same problem in my company: we need 2 target directories, one for the exe and one for the libraries (well, it's a bit more complex but in few words...).
After having spoken with Qt support and got the answer that it's actually not possible ("It is possible only after extracting. After extraction, you can use copy or move operation, unfortunately there is currently no other way.") I decided to use the AdminTargetDir as the second target directory. This because there's no other way to pass dynamic variables to the IFW. So after installation I call a "finalizeInstall_patch.bat" file passing the TargetDir and AdminTargetDir and this will move the libraries directory from TargetDir to AdminTargetDir. Why a .bat patch file ? because it's actually not possible to move a directory using the methods provided by the IFW. Qt support just opened a suggestion-ticket for our problem: https://bugreports.qt-project.org/browse/QTIFW-595
I hope that this answer will help others having same similar problems.
NOTE: There is a way to move a directory (on Windows), calling addOperation("Execute", "cmd /C move source dest...") but this brings to other problems out of topic here.
This worked for us (Qt Installer, macOS):
var args = ["cp", "-R", "#TargetDir#/MyApp.app", "/Applications"];
component.addOperation("Execute", args);

Resources