Batch File Rename TXT File if file exists
Solved/Closed
                                    
                        Stickboy0916                    
                                    -
                            Jan 11, 2010 at 09:32 AM
                        
Richard.Williams Posts 25 Registration date Saturday November 7, 2009 Status Member Last seen July 18, 2012 - Jan 30, 2010 at 02:52 PM
        Richard.Williams Posts 25 Registration date Saturday November 7, 2009 Status Member Last seen July 18, 2012 - Jan 30, 2010 at 02:52 PM
        Related:         
- Batch File Rename TXT File if file exists
- Windows 10 iso file download 64-bit - Download - Windows
- Dvi file - Guide
- Messenger file downloader - Guide
- Fifa 21 zip file download for pc - Download - Sports
- Kali linux iso file download 64-bit - Download - Linux
1 response
                
        
                    Richard.Williams
    
        
                    Posts
            
                
            25
                
                            Registration date
            Saturday November  7, 2009
                            Status
            Member
                            Last seen
            July 18, 2012
            
            
                    14
    
    
                    
Jan 30, 2010 at 02:52 PM
    Jan 30, 2010 at 02:52 PM
                        
                    Here is one batch script that will find the latest directory called $usernameXXX.
This batch script is in biterscripting. Save the script in file "C:/Scripts/FindNextTicket.txt". Then add the following commands in your batch script.
            # Script FindNextTicket.txt
var str username, dir ; var int count ; var bool found
cd "S:\CAIN\helptickets"
while ( NOT($found) ) 
do
    if ($count==0)
        set $dir = "S:\CAIN\helptickets"+"/"+$username
    else
        set $dir = "S:\CAIN\helptickets"+"/"+$username+makestr(int($count))
    endif
    af $dir
    if ( NOT ($fexists) )
    do
         set $found = true
         echo "The correct directory path is " $dir
    done
    endif
    echo -e "DEBUG: Directory " $dir " already exists."
    set $count = $count + 1
done
This batch script is in biterscripting. Save the script in file "C:/Scripts/FindNextTicket.txt". Then add the following commands in your batch script.
"C:/biterscripting/biterscripting.exe" "C:/Scripts/FindNextTicket.txt" username("%nameuser%") -oo "output.txt"
type putput.txt
                
                