2013-06-06 40 views

回答

-1

我不記得任何明顯的方式做到這一點比UNIX外殼等...也許得到MSYS和使用(過時)bash的幫助?

這是一個bash腳本,可以在你從MSYS安裝bash之後使用(或者你可以用一個Linux盒子對它進行排序 - Ubuntu不超過800MB,並且可以作爲LiveCD運行而不會干擾你當前的Windows系統,LiveCD在需要時可以作爲一個系統保護程序一倍:-)

#!/bin/bash 
for each in ./*; do 
    if [ -d $each ]; then # Only folders are minded. 
     # Extract the second part of the folder name. 
     ACCOUNT_NAME=`echo $each | sed "s/\\-/\n/" | head -n 2 | tail -n 1` 
     cp -v ./$ACCOUNT_NAME*.pdf $each 
    fi 
done 
1
@echo off 
setlocal EnableDelayedExpansion 

rem Process all .pdf files 
for %%a in (*.pdf) do (
    rem Get just the file name, ie: "888123AA" 
    set fileName=%%~Na 
    rem Using the file name minus two last chars, ie: "888123" 
    rem get the default folder with that name 
    for /D %%b in (*-!fileName:~0,-2!-*) do (
     rem And copy the file to that folder 
     copy "%%a" "%%b" 
    ) 
) 
+0

的下面任何想法和建議: 在分批參數的路徑運算符的以下用法 取代是無效:%〜娜 對於有效的格式,請鍵入CALL /?或FOR /? 該命令的語法不正確。 – user2389248

+0

使用此''%%〜Na' – foxidrive

+0

哎呀!這是一個錯字!現在修復... – Aacini

相關問題