Estou tentando obter um script que renomeie e mova vídeos. Aqui está o que eu tenho:
#!/bin/bash
src="/mnt/Files_Apps/temp/"
dest="/mnt/Files_Apps/TFTP root/"
for file in "$src"*.*; do
newfile="${dest}$(date -r "$file" +"%Y-%m-%d %H %M %S").MOV"
mv "$file" "$newfile"
done
Eu mudei o conteúdo do diretório de origem várias vezes. Alguns arquivos se engasgam, outros funcionam bem. Não consigo descobrir por que está vendo certos arquivos (todos no formato .MOV, importados do meu iPhone) como duplicados.
Saída de mount
:
//GRAMNAS/Files_Apps on /mnt/Files_Apps type cifs (rw,relatime,vers=1.0,sec=ntlm,cache=strict,username=xxxxx,uid=1208001104,forceuid,gid=1208001114,forcegid,addr=x.x.x.x,unix,posixpaths,serverino,mapposix,acl,rsize=1048576,wsize=1048576,actimeo=1)
ls -li em src antes da execução do script:
~/.scripts$ ls -li /mnt/Files_Apps/temp/
total 697384
13238340 -rwxrwxrwx 1 chris linuxadmin 8844047 Jul 19 21:39 IMG_5624.MOV
13238349 -rwxrwxrwx 1 chris linuxadmin 96701684 Apr 14 11:58 IMG_7355.MOV
13238366 -rwxrwxrwx 1 chris linuxadmin 98690685 Apr 17 15:06 IMG_7426.MOV
13238384 -rwxrwxrwx 1 chris linuxadmin 100289499 May 5 14:32 IMG_7568.MOV
13238579 -rwxrwxrwx 1 chris linuxadmin 75031725 May 8 11:57 IMG_7662.MOV
13239032 -rwxrwxrwx 1 chris linuxadmin 86233885 May 9 10:13 IMG_7672.MOV
13239098 -rwxrwxrwx 1 chris linuxadmin 76930641 May 9 16:03 IMG_7687.MOV
13239466 -rwxrwxrwx 1 chris linuxadmin 78796811 May 13 13:22 IMG_7806.MOV
13240809 -rwxrwxrwx 1 chris linuxadmin 92599209 May 14 12:39 IMG_7951.MOV
ls -li no dest antes da execução do script:
~/.scripts$ ls -li /mnt/Files_Apps/TFTP\ root/
total 0
Saída de script:
~/.scripts$ bash -v videorename.sh
date -r "$file" +"%Y-%m-%d %H %M %S"
mv: '/mnt/Files_Apps/temp/IMG_5624.MOV' and '/mnt/Files_Apps/TFTP root/2016-07-19 21 39 21.MOV' are the same file
date -r "$file" +"%Y-%m-%d %H %M %S"
mv: '/mnt/Files_Apps/temp/IMG_7355.MOV' and '/mnt/Files_Apps/TFTP root/2016-04-14 11 58 26.MOV' are the same file
date -r "$file" +"%Y-%m-%d %H %M %S"
mv: '/mnt/Files_Apps/temp/IMG_7426.MOV' and '/mnt/Files_Apps/TFTP root/2016-04-17 15 06 35.MOV' are the same file
date -r "$file" +"%Y-%m-%d %H %M %S"
.
.
.
ls -li on src após a execução do script:
~/.scripts$ ls -li /mnt/Files_Apps/temp/
total 697384
13238340 -rwxrwxrwx 1 chris linuxadmin 8844047 Jul 19 21:39 IMG_5624.MOV
13238349 -rwxrwxrwx 1 chris linuxadmin 96701684 Apr 14 11:58 IMG_7355.MOV
13238366 -rwxrwxrwx 1 chris linuxadmin 98690685 Apr 17 15:06 IMG_7426.MOV
13238384 -rwxrwxrwx 1 chris linuxadmin 100289499 May 5 14:32 IMG_7568.MOV
13238579 -rwxrwxrwx 1 chris linuxadmin 75031725 May 8 11:57 IMG_7662.MOV
13239032 -rwxrwxrwx 1 chris linuxadmin 86233885 May 9 10:13 IMG_7672.MOV
13239098 -rwxrwxrwx 1 chris linuxadmin 76930641 May 9 16:03 IMG_7687.MOV
13239466 -rwxrwxrwx 1 chris linuxadmin 78796811 May 13 13:22 IMG_7806.MOV
13240809 -rwxrwxrwx 1 chris linuxadmin 92599209 May 14 12:39 IMG_7951.MOV
ls -li no destino após a execução do script:
~/.scripts$ ls -li /mnt/Files_Apps/TFTP\ root/
total 0