Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, April 29, 2011 2:21 AM
looking for a simple one like way to move files from one location to another based on the content within the files.
what i need is to search a directory with 10,000+ text files and search the first line in the text file for a specific word and move the files that match the filter to another directory.
So far I have this and it anit working.
get-childitem c:\test\ -filter *.txt -recurse | select-string -list -pattern "XYZContent" | foreach-object -process [move-item c:\test\ c:\test2\
All replies (2)
Friday, April 29, 2011 3:13 AM âś…Answered
get-childitem c:\test\ -filter *.txt -recurse | select-string -list -pattern "XYZContent" | move -dest C:\test2
Friday, April 29, 2011 3:47 AM
Worked like a champ! took a little while to plow through all 10,000 plus files but it did it!
Thanks