Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想根据文件名创建一系列目录,然后将关联的文件移动到正确的目录,这些文件将是来自站点的 .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
只需用于*.pdf在您的 for 循环中提取所有 pdf 文件:
*.pdf
for file in *.pdf do dir="${file%%.*}" mkdir -p "$dir" mv "$file" "$dir" done