Tomoya
February 22, 2022, 11:55am
1
こんにちは、ファイル名の変更およびフォルダ移動に関して質問がございます。
所定のフォルダに複数ファイル(ファイル名:ファイルA~ファイルC)が存在し、
データテーブルで下記のようなデータテーブルがあるとします。
旧ファイル名 新ファイル名 移動フォルダ
A AA AAA
B BB BBB
C CC CCC
この時、
①旧ファイル名を新ファイル名に変更
②用意された別フォルダ(元々ある移動フォルダ)に移動
を行いたいです。
アプローチとして、繰り返しコレクションの各要素でファイル名を取得して旧ファイル名をキーに新ファイル名に変更する(つまり処理①)までは実施できたのですが、②の実装がうまくいきません。原因は①でitemに格納されたファイル名が変更されているためです。(当然ですが)
スムーズな解決方法があればご教示いただきたいです、よろしくお願いいたします。
Gokul001
(Gokul Balaji)
February 22, 2022, 12:02pm
2
HI @Tomoya
Correct me if iam wrong
You need to move a folder to another folder with the new folder name , right?
Regards
Gokul
Tomoya
February 22, 2022, 12:12pm
3
No, rename the file and move it to a folder that is already prepared.
Gokul001
(Gokul Balaji)
February 22, 2022, 12:23pm
4
Okay so you can try this as in this thread
HI @Anh_Nguyen
Try like this
Use For each file in folder and pass your path.
And if you use currentfile.name will get you the name.extension whatever the name can be
if you want path pass currentfile.tostring
[image]
Regards
Gokul
Instead of renaming in the same folder you can simply use move file and give the new name there like this
Regards
Gokul
2 Likes
system
(system)
Closed
February 25, 2022, 12:24pm
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.