سلام
من حجم زیادی فایل ویدئویی دارم روی هارد اکسترنالم که میخوام براشون دایرکتوری درست کنم و هر فایل را به دایرکتوری مروبط به خودش منتقل کنم.در اینترنت به دنبال یه اسکریپت برای این کار بودم و تونستم یه اسکریپت برای این کار پیدا کنم.
#!/usr/bin/env bash## iterate through each file whose name ends in 'jpg'
## saving it as $file. ~ is your $HOME directory
for file in ~/Desktop/My_pictures/*jpg
do
## basename will remove the path (~/Desktop/My_pictures) and also
## remove the extension you give as a second argument
name="$(basename "$file" .jpg)"
## create the directory, the -p means it will create
## the parent directories if needed and it won't complain
## if the directory exists.
mkdir -p ~/Desktop/My_pictures/"$name"
## copy the file to the new directory
mv "$file" "~/Desktop/My_pictures/$name"
done
من اسکریپت را به این صورت تغییر دادم
#!/usr/bin/bash## iterate through each file whose name ends in 'jpg'
## saving it as $file. ~ is your $HOME directory
for file in "/home/behrooz/sss er/*.mkv"
do
## basename will remove the path (~/Desktop/My_pictures) and also
## remove the extension you give as a second argument
name="$(basename "$file" .mkv)"
## create the directory, the -p means it will create
## the parent directories if needed and it won't complain
## if the directory exists.
mkdir -p '/home/behrooz/sss er/"$name"'
## copy the file to the new directory
mv "$file" "/home/behrooz/sss er/$name"
done
بعد از اجرا این ارور را میده
mv: cannot stat ‘/home/behrooz/sss er/*.mkv’: No such file or directory
و یه دایرکتوری به نام "$name" در ادرسی که اسکریپت در اون اجرا میشه ساخته میشه.
- - , .
اوبونتو...
ما را در سایت اوبونتو دنبال می کنید
برچسب : نویسنده : استخدام کار ubuntu بازدید : 39 تاريخ : چهارشنبه 14 بهمن 1394 ساعت: 21:43