-1

I have a directory with thousands of video file. How can I move 15 of the files (video.mp4) to another location.

2 Answers2

1

Your mv tag already gives the solution. man mv states:

Name: mv - move (rename) files
Synopsis:
    mv [OPTION]... [-T] SOURCE DEST
    mv [OPTION]... SOURCE... DIRECTORY
    mv [OPTION]... -t DIRECTORY SOURCE...

Description: 
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
<...>

If you use ls to find 15 file names, you can move them with mv.

Ljm Dullaart
  • 4,142
  • 11
  • 26
0

i find a script and mod it for this work

#!/bin/bash
c=1; d=1; mkdir -p NEWDIR_${d}
for mpeg_file in *.mp4
do
if [ $c -eq 15 ]
then
d=$(( d + 1 )); c=0; mkdir -p NEWDIR_${d}
fi
mv "$mpeg_file" NEWDIR_${d}/
c=$(( c + 1 ))
done