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..
wget -r -l1 -A.pdf
cd / /
for file in {ait,anak,pro}*.*; do
dir=${file%%.*}
mkdir -p "$dir"
mv "$file" "$dir
done
Just use *.pdf
to pick up all pdf files in your for loop:
for file in *.pdf
do
dir="${file%%.*}"
mkdir -p "$dir"
mv "$file" "$dir"
done
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.