Moving of files from folder to another folder

January 11, 2011 at 00:22:17
Specs: Windows XP, 1 GB
I have a different requirement, I have a folder name "LOGS", inside Logs there are many folders and sub folders. but in certain folders there is a folder called "Pass". In this folder (pass) suppose some files with extension *.logs. is there any way possible to select the *.logs of all the folders and subfolders of the Main parent Folder Logs?

I am tellng what I have done already, I have created a batch file with

./Pass/ del s*.log

but this batch file has to be copied in all the folder to execute. What I want that I will copy the Batch file in side LOG folder and all the folder subfolder containing s*.log will be automatically deleted or moved to a different folder if I prefer.

I also tried dir /b /s *.txt *.tiff > file_list.txt
but this only gives the names of all the files not moving the original files to different destination folder.

Can any body help this please.

thank you


See More: Moving of files from folder to another folder

Report •

#1
January 11, 2011 at 00:39:53
for /f "tokens=*" %%j in ('dir /b/s *.log') do move %%j D:\

Moves all .log files in subfolders where the script is running to destination: D:\

Edit the destination.

Regards,

Happy is ONE who says I am an OttoMAN.


Report •

#2
January 11, 2011 at 04:59:14
Hi, I am using this command with a little modification as you said

for /f "tokens=*" %%j in ('dir /b/s smscntr_*.log') do move %%j D:\Deb\Temp

but in the desired folder, "Temp" only few (4 or 5) smsmcntr_ .log files are moving.

There are altogether more than 600 files inside the LOG folder, which I want to delete, I like your approach --> "to move the files into a different folder then delete the folder" But how can I move all the smscntr . log files to the destination folder.

I don't want to move all the *.log files those logs start with smscntr*.logs I want to move. I hope now I can get any solution.

Thanks


Report •

#3
January 11, 2011 at 07:53:09
Hi, I am using this command with a little modification as you said

for /f "tokens=*" %%j in ('dir /b/s smscntr_*.log') do move %%j D:\Deb\Temp

but in the desired folder, "Temp" only few (4 or 5) smsmcntr_*.log files are moving.

There are altogether more than 600 files inside the LOG folder, which I want to delete, I like your approach --> "to move the files into a different folder then delete the folder" But how can I move all the smscntr . log files to the destination folder.

I don't want to move all the *.log files those logs start with smscntr*.logs I want to move. I hope now I can get any solution.

Thanks


Report •

Related Solutions

#4
January 11, 2011 at 10:33:36
Try

for /f "tokens=*" %%j in ('dir /b/s *smscntr_.log') do move %%j D:\Deb\Temp

Happy is ONE who says I am an OttoMAN.


Report •

#5
January 11, 2011 at 11:03:58
I tried that, but still not working, also I didn't get the idea of how *smscntr_.log will work. my files that i want to move start with smscntr_.....log. So in that sense smscntr_* would be perfect I think. However I don't know why is this not working. Logically it is correct.

I even tried without "tokens=*" but no luck,


Report •

Ask Question