Move files to folders based on value in .csv file using .bat file - csv

I need to move .jpg images from one folder to another using listing from CSV which changes periodically.
I need to move .jpg images from one folder into sub folders based on a value in a CSV file which periodically changes.
For example I have a folder called D:\photos which folder contains numbered sub folders i.e.
D:\photos\1000
D:\photos\1001
D:\photos\1002
Now in my folder D:\photos There are three files named a.jpg, b.jpb, c.jpb where the output.csv looks like following
Output
1001
So as per CSV I have to move mention above files into d:\photos1001 which will be removed form actually folder.
Next in my folder D:\photos there are 3 files. a.jpg, b.jpg and c.jpg
and output.csv contains following information.
Output
1002
In this case I need to move the files a.jpg, b.jpg and c.jpg into D:\photos1002 then delete the files from D:\photos
Or another way I can change files in 1002_a.jpg format too in the D:\photosfolder.
Can anyone help me out with creating a .bat file that does this?

Move all .csv file from one folder to another folder
#echo off
move E:\folder_from*csv*.* E:\folder_to

Related

Copy duplicate files in a folder

I have a folder structure like below -
D:\Folder1\file1\doc.txt
D:\Folder1\file2\doc.txt
I want to copy the above 2 doc.txt files to new location ignoring it's parent folders but because they have same name I cannot keep both at same location. I cannot change the filename because of client's requirement. Is there a way we can copy the second duplicate file at same location?
I am currently using robocopy to move files from src to destination.

Applescript help: Move files to folders according to a CSV file

I am looking for an AppleScript that moves files in a single directory into new folders based on info provided in a CSV file, where the columns are A) Filename with extension B) New folder title. Thank you.

How to delete a file (deep) in a ZIP folder in Python?

I'm writing a script that is extracting 2 JSON files from deep (3 folders down) in a ZIP Folder, modifying its contents, and writing those files back into that same folder. The only issue is that when I write the JSON Files back into the folder where they were initially pulled from, they do not overwrite so now I have 4 files named (product, product, package, package). I wish to delete or overwrite the non-modified files but don't know how.
I have looked up how to do it on other threads and it says it's not supported but I was hoping by now someone had addressed this without having to do the "rewrite the entire directory minus the old files into a new ZIP" routine. I've also tried writing to the zip file with 'w' mode but that just deletes the whole other contents of the zip file.
This is how I'm writing each file back into the ZIP file
zf = zipfile.ZipFile(ZipName, 'a')
zf.write('package.json',addressBook[0],compress_type = zipfile.ZIP_DEFLATED
zf.write('product.json',addressBook[1],compress_type = zipfile.ZIP_DEFLATED

SSIS to get the particular file from multiple files and copy to different folder

my question is how we will create SSIS package to get the particular file from multiple files and copy to different folder
Need Help
You can use File System Task in your package control flow.
Configure the properties as below:
DestinationConnection: Enter the full file path of the folder you want to move your file to e.g c:\Users\ToTest
Operation: Change to Move file.
SourceConnection: Enter the full file path of the folder where your file is, including the file name and extension e.g c:\Users\Test\testfile.csv
You'll need at least two components.
Use a Foreach Loop container with the default Foreach File Enumerator on the Collection tab. Set Folder: to \YourFolder and build an expression under Files: to identify the particular file you're interested in.
Inside the Foreach Loop container, add a File System Task to Copy the file from the Source folder to the Destination folder.

Add headers to multiple text files SSIS

I have a process that I want to create in SSIS. What I have so far is below.
So the scenario is that a number of different file types are downloaded to a specific location - which has been created as a variable "RootFolder"
Within that RootFolder, is a folder called "Archive"
The first part of the process is to create a folder within the variable of ArchiveFolder, which is basically todays date.
Then in a For Loop Container, it copies all the files in the RootFolder to the Archive Folder. So we have a history of the files received.
The next step that I want to carry out in SSIS is to add a header line at the top of each of those text files. So all the files that still exist in the Root Folder get a header added to the top of the file. Is there something direct in SSIS to do this, or would I need a .bat file to do it and have an Execute Process Task, to call that bat file. Either way I have no idea how to achieve this bit. Your help will be appreciated.