フィルターのクリア

Renaming Files

2 ビュー (過去 30 日間)
Danielle Leblanc
Danielle Leblanc 2011 年 8 月 6 日
I used 7 zip to split large excel files. It gave them to me in the following format: naic1.xlsx.001,...naic1.xlsx.029 for file 1 naic2.xlsx.001,...naic2.xlsx.030 for file 2 etc... naic29.xlsx.001,...naic2.xlsx.006 for file 29
I tried all the renaming functions in file exchange without any luck. I want to rename them as naic1.xlsx .....naic(a consecutive number I think it will be 833).xlsx Any help with that is greatly appreciated

採用された回答

Fangjun Jiang
Fangjun Jiang 2011 年 8 月 6 日
Something alone the line as below. Proceed with caution.
count=1;
for k=1:29
Files=dir(['naic',num2str(k),'.xlsx.*']);
for j=1:length(Files)
movefile(Files(j).name,['naic',num2str(count),'.xlsx']);
count=count+1;
end
end
  3 件のコメント
Fangjun Jiang
Fangjun Jiang 2011 年 8 月 6 日
I think I might know the problem. Copy all your files to a temporal folder and run the code again. This time it uses movefile() and it also limit the files returned by dir(). You should also not to expect the code will work without any modification. I don't have the exact folder/files as you have. You should understand the code, do a little debugging and make it work.
Fangjun Jiang
Fangjun Jiang 2011 年 8 月 6 日
Please note I've modified the code.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by