How to make a .bat to move files in a folder to a different folder, based on a text file listing the files to be moved? - list

I have a lot of files in one folder that I want to move to another folder. I have the files I want moved listed in a text file. Is there a way I can make a .bat so the files listed in the text file get moved to another folder?
I found this https://superuser.com/questions/355584/how-to-delete-files-from-a-folder-using-a-list-of-file-names-in-windows where this code
for /f "delims=" %%f in (files_to_delete.txt) do del "%%f"
sort of does I want, meaning that the batch uses a text file to process files, except it deletes the files. How do I modify this code so the files are moved to another folder?
Another question, the above code deletes files without going through the recycling bin. So how do I modify the code so when it deletes, the files get moved to the recycling bin. If that happens, then I can easily drag it out to a new folder. I'm a newb using Windows 10. Thank you.

Related

Apple script to move files of a type

I have a folder of approximately 1800~ .7z files. Some of them uncompress as a single file, some uncompress as a folder with several of the same type of file. If I were to uncompress all of them at the same time, what I end up with is a folder full of .7z files, folders containing multiple of a file type, and multiple single instances of that same file type.
What I would like to do is run a script that would take all of the same file types, from all containing folders below the main folder, and copy them to another specified folder. I unfortunately don't have really any experience with Apple Scripts and while this may be simple, it sounds insurmountable to me. Any input would be appreciated.

Adding a CSV file to a project in Visual Studio

I am working on a project where I have to read in serveral pre-existing CSV (dog.csv, horse.csv, etc.). I want to know how would I add these file into my project so that I may test to see if my print functions work (the code is written in c++). Would I have to copy and paste the files into the debugging folder or would I place it under the test folder of the project?
You can include the files in your project in whatever (sub)folder you wish by using Right click -> Add -> Existing Item. Then, right-click on each file and choose Properties. Set up "Copy to output directory" to "Copy if newer".
Then after build, your files will be copied into the bin/debug folder.
To read the file, you can just use:
System.IO.File.ReadAllText("dog.csv");
Another possible way is to add a file within project, right click and select properties, and then in Copy to Output Directory, select Copy always. This way, csv file will be automatically copied in your debug and release packages too.
string executableLocation = Path.GetDirectoryName(
Assembly.GetExecutingAssembly().Location);
string csvLocation= Path.Combine(executableLocation, "file.csv");
Above code will read file location from bin directory where your csv file will be stored.
This link should help guide you how to add CSV files to a project.
If you wanted to do a down and dirty way you could just save the CSV's somewhere on your local machine, and then hard code the file path to that location.
Example:
c:\test\Dog.csv and then set that as a variable for whenever you need to read in the csv file.

Filezilla lets to duplicate files with utf8 filenames in same folder

When I'm uploading all folder tree with all files, filezilla corrupts files with utf8 filenames. It writes them there, the files are OK, but they isn't served by nginx.
When I open some folder and select files from my computer same folder, draging them by hand, they duplicates, but these new files, are shown by nginx!
So if I originally uploaded 6 files to current folder when uploading all folders tree, then opening just this one current folder Filezilla lets me again to upload same 6 files, but it becomes as 12 files. When I select to drag files again, it won't become 18, Filezilla overwriting these 6 which I had draged by hand, leaves another 6 untouched.
I have about 2000 different folders in my folders tree, with files inside. When I upload all folder tree, no files which has utf8 in filename are shown by nginx. When I open every dir and redrag files by hand, they start work on nginx, also they are draged as new ones in that folder as I said before.
Resume:
Filezilla uploading files somehow wrong when uploading all folder tree... But Correctly when dragging only files.
I googled for you, and found this advice:
I am not sure if it solves your problem, but try under "File
server manager" "character set" and there force UTF-8.

Importing a list of files in a subdirectory into an array

I am working on a program which requires me to, at multiple points, import the contents of a subdirectory of my C++ Project, into a vector<string>. Assuming the project directory is called root\ and the directory I want to scan is root\userFiles. This folder only contains additional files and no further subfolders.
However the trick is I am restricted, I cannot use any of the boost, dirent.h header files. Just the basic ones.
One solution I was able to come up with was the use of the command system( "dir /b * > userFiles/fileList.txt" ); and then filter the results in by reading that file and importing it into the vector.
My issue is how do I "cd" to that folder, run that command while still in that folder, and then exit back to the root folder..
I have tried using the system("chdir userFiles/")command but I am still getting all the files in the root folder.
Any help would be appreciated.
So I worked out an easier way of doing this.
int main()
{
system("chdir userFiles && dir /b * > fileList.txt");
}
I am using the && operator to join together multiple strings of commands. Since I am only using the system() function once all these commands will be part of the same process.

How to replace a folder in a pending cl in p4?

I want to replace folder A in P4 by another folder A.
The two folders have different files and sub folders.
I know, we can do it by deleting old folder A then adding new folder A.
But, can I do it with only one step in a pending changelist ?
As following result in that pending cl:
If this file is in old folder, but not in new folder, then it is marked by "delete".
If this file is in new folder, but not in old folder, then it is marked by "add".
If this file is in new folder and also in old folder, then it is marked by "modify".
Thank you
Are both these folders under source control?
That is, are you trying to make //depot/folder/A contain what //depot/other/A_prime contains?
If so, consider using 'p4 copy':
p4 copy //depot/other/A_prime/... //depot/folder/A/...
If the other folder A is just something you have on your hard disk, then consider using 'reconcile':
p4 edit //depot/folder/A/...
rm -r /path/to/depot/folder/A/*
cp -r /path/to/other/folder/A/* /path/to/depot/folder/A
p4 reconcile -aed //depot/folder/A/...
I kind of like the 'p4 copy' approach, myself, so I'd be tempted to check that other folder into Perforce (in a different location in the repository, naturally), so that I could then run 'p4 copy'.