Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have many files, e.g. 1000, with different names that I have a list of. If I want to move certain files (suppose 400) to any directory, how can I do this?

The problem is the files have no extension to them, they are without file extension, so I cannot sort them accordingly and then move them.

Is there any command through which I put those 400 file names, along with some 'move' command and move them to any particular folder? Or can I do this with a batch file?

share|improve this question
    
What operating system are you on? –  slhck Jul 30 '13 at 17:45
    
If you use BSD, OS X or Linux then you can use the file command in conjunction with find. If you run windows then you will either need to find their windows versions, install cygwin or boot from a liveCD. –  Hennes Jul 30 '13 at 17:46
1  
is there any pattern to the file names ? update your post with the kind of files you ant and the ones you donot –  Shekhar Jul 30 '13 at 17:50
    
actually I have windows xp(service pack 3) and the file names are unique and all have alphanumeric names(so I thing there is no pattern through which we can sort files) –  Chirag Verma Jul 30 '13 at 18:08
1  
If you dont wan't to do it manually, there has to be some kind of similarity in the files that you want. Are these files browser caches ? –  Shekhar Jul 30 '13 at 18:27

1 Answer 1

On Windows, in Powershell:

Get-Content .\FilesToMove.txt | ForEach-Object { Move-Item $_ C:\Destination\Path\ }

You would then put the names of the files, one per line, in FilesToMove.txt.

Or, if you don't have PowerShell, try something like this in a batch file:

for /f "delims=" %%i in (FilesToMove.txt) do echo F|xcopy "C:\Source\Path\%%i" "c:\Destination\Path\%%i" /i /z /y

Your FilesToMove.txt should have the filenames that you want to copy from the one directory to the other. You will then place the FilesToMove.txt in the same directory as the source files and the batch file will go in the same directory, too.

If you want to use full paths to the files, you can place them anywhere, I guess and you'd want to modify the command appropriately.

This will do a copy. If you want to delete the files after, you could add a second line to your batch file:

for /f "delims=" %%i in (FilesToMove.txt) do del C:\temp\FolderA\%%i
share|improve this answer
    
ok, but what is this powershell, i have win XP(SP-3) installed in my pc. so can I run this in the CMD window, does it work ? –  Chirag Verma Jul 30 '13 at 18:09
    
I updated the answer with something that will hopefully work in a batch file. –  Jack Jul 30 '13 at 18:20
    
ok, I am doing some sample test as per your code, and will let you know in 5 mins if this works for me or not. ok ! –  Chirag Verma Jul 30 '13 at 18:38
    
hey, I have put this in my test1.bat file, but nothing happens: for /f "delims=" %%i in (FilesToMove.txt) do echo D|xcopy "D:\eiti\pics\wallpapers%%i" "D:\eiti\pics\wallpapers\move\%%i" /i /z /y can you tell me what is the error here. wallpaper folder have the files that I want to move and the move(folder inside wallpaper folder) is the destination folder –  Chirag Verma Jul 30 '13 at 18:48
    
hey, Jack I have found an solution for this in some other place, but I have to know about this solution also that you have given; as a backup, in case the solution I have found doesn't work. thanks –  Chirag Verma Jul 30 '13 at 18:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.