home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.linux.ubuntu      I preferred Xubuntu, seemed a bit faster      134,474 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 134,393 of 134,474   
   Paul to Dr. Noah Bodie   
   Re: GROK Made a Simple File Renamer   
   17 Sep 25 16:07:57   
   
   XPost: alt.os.linux.mint   
   From: nospam@needed.invalid   
      
   On Tue, 9/16/2025 6:38 PM, Dr. Noah Bodie wrote:   
   > This is similar to GPRename but not as sophisticated. You can rename all of   
   the files in the current folder. Note: it is case sensitive (if you need this   
   function) so you can switch cases on files, IE rename "Buster.txt" as   
   "buster.txt"   
   >   
   >   
   > #!/bin/bash   
   > ...   
   > # Perform rename operation   
   > for file in *; do   
   >     if [[ "$file" == *"$search_string"* ]]; then   
   >         new_name="${file//$search_string/$replace_string}"   
   >         if [ "$file" != "$new_name" ]; then   
   >             mv -n "$file" "$new_name"   
   >             if [ $? -eq 0 ]; then   
   >                 echo "Renamed: $file -> $new_name"   
   >             else   
   >                 zenity --error --text="Error renaming $file to $new_name"   
   --width=200   
   >             fi   
   >         fi   
   >     fi   
   > done   
      
   Your error dialog, needs some choices. This is a crude example.   
      
               else   
                   # zenity --error --text="Error renaming $file to $new_name"   
   --width=200   
                   zenity --question --text "Error renaming $file to $new_name"   
   --ok-label="Continue" --cancel-label="Cancel"   
                   if [ $? -ne 0 ]; then   
                      exit 1   
                   fi   
               fi   
      
   In the picture, I clicked "Continue" the first time, and "Cancel" the   
   second time the dialog appeared.   
      
      [Picture]   
      
       https://i.postimg.cc/FzxG5Bkj/zenity-dialog.gif   
      
      Paul   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca