Results 1 to 8 of 8

Thread: How to bulk edit files?

  1. #1

    Default How to bulk edit files?

    Does IrfanView have the ability to bulk edit files, removing the first 6 characters(and a space), leaving the rest of the file name the same?

    For example:

    123456 this is file 1
    789123 this is file 2
    345673 this is file 3

    changed to:

    this is file 1
    this is file 2
    this is file 3

    I know how to use the 'Batch Conversion' function, but I can't seem to find how to do it. It's probably under 'Batch rename setting:Name pattern', but I don't know what code to use there. Anyone know? Or, is it done somewhere else?

    Win 7, 64bit

    Thanks!

  2. #2
    Multiple User jazzman's Avatar
    Join Date
    Aug 2007
    Posts
    499
    Version
    IrfanView 4.51
    OS
    32-bit Win 7 Professional SP1
    CPU Cores
    1

    Default

    There's a Help Button in the batch dialog. Among other things it says

    [A-B] - in combination with $D, $d, $F and $N; get range/partial text from position A to B

    example: $N[0-5] => get first 5 characters from the file name

    I haven't tried it, but I hope that should do the trick.

  3. #3

    Default

    Quote Originally Posted by jazzman View Post
    There's a Help Button in the batch dialog. Among other things it says

    [A-B] - in combination with $D, $d, $F and $N; get range/partial text from position A to B

    example: $N[0-5] => get first 5 characters from the file name

    I haven't tried it, but I hope that should do the trick.
    Thanks I'll try that and experiment. I'll post back with results.

  4. #4

    Default

    Quote Originally Posted by tkmops View Post
    Thanks I'll try that and experiment. I'll post back with results.
    Ah, I made a mistake...I need to bulk re-name folders, not files. Can Irfanview bulk re-name folders? I tried dropping folders into the IrfanView 'input box', and it renamed all the files inside the folders.
    My bad, sorry.

  5. #5
    Professional User Mij's Avatar
    Join Date
    Mar 2007
    Location
    Camberley, Surrey, UK
    Posts
    2,764
    Version
    IrfanView 4.51
    OS
    32-bit Win 10
    CPU Cores
    3

    Default

    With some limitations, yes it can rename folders.

    First if you want to use $D or $d , with or without the [A-B] bit, you can only use it in the "Output directory for result files" box.
    $D and $d do not work in the "Name pattern" box
    Second the "Replace ... with ..." options only work in the "Name pattern" box. They do not work in "Output directory...".
    Third if you want to use [A-B] to select the end part of the name, as you had in your example, you still have to specify a value for B. You can use a value for B greater than anything you are likely to find. So something like [5-50] will then select everything from the fourth letter to the end even though the folder name has a lot less than 50 letters.
    If you have a path like c:\this\is\the\path\bit_to_be _shortened\file.jpg then putting just $d[5-50] in the "Output directory..." box will give
    c:\this\is\the\path\bit_to_be _shortened\to_be_shortened\file.jpg
    $D[5-50] would give you c:\s\is\the\path\bit_to_be _shortened\file.jpg
    You would probably need to put all the shortened name subfolders into the same parent folder (c:\this\is\the\path) using
    c:\this\is\the\path\$d[5-50]\file.jpg

    Last while you are experimenting always use the "Run test rename" button until you are sure you have got it right. Then you will not risk damaging your images by accidentally overwriting or modifying them.

  6. #6

    Default

    Quote Originally Posted by Mij View Post
    With some limitations, yes it can rename folders.

    First if you want to use $D or $d , with or without the [A-B] bit, you can only use it in the "Output directory for result files" box.
    $D and $d do not work in the "Name pattern" box
    Second the "Replace ... with ..." options only work in the "Name pattern" box. They do not work in "Output directory...".
    Third if you want to use [A-B] to select the end part of the name, as you had in your example, you still have to specify a value for B. You can use a value for B greater than anything you are likely to find. So something like [5-50] will then select everything from the fourth letter to the end even though the folder name has a lot less than 50 letters.
    If you have a path like c:\this\is\the\path\bit_to_be _shortened\file.jpg then putting just $d[5-50] in the "Output directory..." box will give
    c:\this\is\the\path\bit_to_be _shortened\to_be_shortened\file.jpg
    $D[5-50] would give you c:\s\is\the\path\bit_to_be _shortened\file.jpg
    You would probably need to put all the shortened name subfolders into the same parent folder (c:\this\is\the\path) using
    c:\this\is\the\path\$d[5-50]\file.jpg

    Last while you are experimenting always use the "Run test rename" button until you are sure you have got it right. Then you will not risk damaging your images by accidentally overwriting or modifying them.
    I've tried the $N[7-80] in the Name pattern box, and using a test folder for the 'Output directory for result files', and that works for files just fine.

    But, I'm confused as to how to use the $D[7-80] command. I tried using it in the 'Output directory for result files' box(this doesn't make sense to me, but that's what you seemed to be saying???)....nothing happened.
    I can't use the 'replace with' options as the first 6 characters are all different for each folder.
    Where is the 'Run test rename' button? I don't see one in my batch conversion menu.
    Thanks!

  7. #7
    Professional User Mij's Avatar
    Join Date
    Mar 2007
    Location
    Camberley, Surrey, UK
    Posts
    2,764
    Version
    IrfanView 4.51
    OS
    32-bit Win 10
    CPU Cores
    3

    Default

    I thought what I said would be enough for you to experiment and work out for yourself how to do what you want.
    However I have captured an example of what I think you want and attached it at the bottom of the post (before and after running batch).
    It uses $d[8-80] and applies it to images having the path "C:\Users\Mike\Pictures\This is 2013-09-30"

    $d will pick up the final folder name of the path "This is 2013-09-30" which is the parent folder containing the file names.
    $d[8-80] will return everything from character 8 to character 80 of this folder name (remembering to start counting from 0). So "This is " is cut from the start, and since there is nothing after character 17 (well before 80), you are left with just the rest of the folder name, "2013-09-30" as the renamed parent folder.

    The results box does not tell you where this renamed folder will be put. You have 3 choices.
    Choice 1 is to type in the full path name that you want before your renamed folder and then add $d[8-80] after it.
    Choice 2 is to leave the folder name in the "Look In" box the same as it was when you added the image files i.e "This is 2013-09-30" and put just "$d[8-80]" in the "Output Directory... " box. You would then get a path name "C:\Users\Mike\Pictures\This is 2013-09-30\2013-09-30" and the files will be copied into the renamed subfolder "2013-09-30" as well as remaining in the original parent folder "This is 2013-09-30"
    Choice 3 (which I have illustrated) is to press the up arrow beside the "Look In" box to go up a level to the "Pictures" folder. Now when you run the batch process the path name will be "C:\Users\Mike\Pictures\2013-09-30" and the images will be copied there. The original parent folder "This is 2013-09-30" also remains again with the original files in it. You will have to delete it manually if you do not want to keep it.

    There is a 4th choice to use "Create subfolders in destination folder" from the Advanced options of Batch conversion". For that you would need to run Batch Conversion - Rename without any conversion options set other than in the Miscellaneous section. That is a yet higher level of complexity that I do not think you will need though.

    $D[8-80] picks up the full path name (after the Drive letter) and strips characters from the start of that. So you would get "Mike\Pictures\This is 2013-09-30". Only the drive letter now comes from the "Look In" box. You might use this if you were copying to a USB stick and wanted to remove the root directory name "Users" that you had on the C drive. Again I do not think that is what you asked for.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Image 041.png 
Views:	88 
Size:	112.7 KB 
ID:	4087   Click image for larger version. 

Name:	Image 042.png 
Views:	84 
Size:	122.2 KB 
ID:	4088  

  8. #8

    Default

    Quote Originally Posted by Mij View Post
    I thought what I said would be enough for you to experiment and work out for yourself how to do what you want.
    However I have captured an example of what I think you want and attached it at the bottom of the post (before and after running batch).
    It uses $d[8-80] and applies it to images having the path "C:\Users\Mike\Pictures\This is 2013-09-30"

    $d will pick up the final folder name of the path "This is 2013-09-30" which is the parent folder containing the file names.
    $d[8-80] will return everything from character 8 to character 80 of this folder name (remembering to start counting from 0). So "This is " is cut from the start, and since there is nothing after character 17 (well before 80), you are left with just the rest of the folder name, "2013-09-30" as the renamed parent folder.

    The results box does not tell you where this renamed folder will be put. You have 3 choices.
    Choice 1 is to type in the full path name that you want before your renamed folder and then add $d[8-80] after it.
    Choice 2 is to leave the folder name in the "Look In" box the same as it was when you added the image files i.e "This is 2013-09-30" and put just "$d[8-80]" in the "Output Directory... " box. You would then get a path name "C:\Users\Mike\Pictures\This is 2013-09-30\2013-09-30" and the files will be copied into the renamed subfolder "2013-09-30" as well as remaining in the original parent folder "This is 2013-09-30"
    Choice 3 (which I have illustrated) is to press the up arrow beside the "Look In" box to go up a level to the "Pictures" folder. Now when you run the batch process the path name will be "C:\Users\Mike\Pictures\2013-09-30" and the images will be copied there. The original parent folder "This is 2013-09-30" also remains again with the original files in it. You will have to delete it manually if you do not want to keep it.

    There is a 4th choice to use "Create subfolders in destination folder" from the Advanced options of Batch conversion". For that you would need to run Batch Conversion - Rename without any conversion options set other than in the Miscellaneous section. That is a yet higher level of complexity that I do not think you will need though.

    $D[8-80] picks up the full path name (after the Drive letter) and strips characters from the start of that. So you would get "Mike\Pictures\This is 2013-09-30". Only the drive letter now comes from the "Look In" box. You might use this if you were copying to a USB stick and wanted to remove the root directory name "Users" that you had on the C drive. Again I do not think that is what you asked for.
    Thanks for everyone's help, I got it all figured out.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •