I would like to create a series of directories based on the filename and then move the associated files to the correct directories the files would be .pdf from a site and i use wget command for download them i try to do this for custom name but i can't understand how can i do this for random name .pdf .... and for example the first 10 pdf files if there are many..
我想基于文件名创建一系列目录,然后将相关文件移动到正确的目录,文件将是.pdf从一个站点,我使用wget命令下载它们我尝试这样做自定义名称,但我无法理解如何为随机名称.pdf ....执行此操作,例如前10个pdf文件,如果有很多..
wget -r -l1 -A.pdf
cd / /
for file in {ait,anak,pro}*.*; do
dir=${file%%.*}
mkdir -p "$dir"
mv "$file" "$dir
done
1 个解决方案
#1
1
Just use *.pdf
to pick up all pdf files in your for loop:
只需使用* .pdf来获取for循环中的所有pdf文件:
for file in *.pdf
do
dir="${file%%.*}"
mkdir -p "$dir"
mv "$file" "$dir"
done
#1
1
Just use *.pdf
to pick up all pdf files in your for loop:
只需使用* .pdf来获取for循环中的所有pdf文件:
for file in *.pdf
do
dir="${file%%.*}"
mkdir -p "$dir"
mv "$file" "$dir"
done