0

I want to move files from one folder to another folder, my code is working fine when file name doesn't contain spaces but if there is a space in a file name then I am getting an error My Code is as follows :

find [folderName] -size +1k -type f -name \*.txt -print0 | while IFS= read -r -d '' file; do
      echo $file
      mv $file targetfolderName    
      done

File Names

sample 01.txt test - copy 01.txt

1 Answers1

1

Try this

find [folderName] -size +1k -type f -name \*.txt -print0 | while IFS= read -r -d '' file; do
      echo $file
      mv "$file" targetfolderName    
      done
SHW
  • 14,786
  • 14
  • 66
  • 101