32367

Append folder name and increment by 1 using batch script

I am a little green to this part of batch scripting, but what I am trying to do is a append a bunch of folder names and increment by 1 whilst respecting the time stamp i.e newest folder first, oldest folder last.

I have looked at other scripts with no avail.

Before

Folder 1 Folder 2 Folder 3 Folder 4 Folder 5 Folder 6

After

Folder 1 - Part 001 - Time stamp 1/1/2014 - 18:55:20 Folder 4 - Part 002 - Time stamp 1/1/2014 - 18:55:24 Folder 3 - Part 003 - Time stamp 1/1/2014 - 18:56:28 Folder 6 - Part 004 - Time stamp 1/1/2014 - 18:58:24 Folder 5 - Part 005 - Time stamp 1/1/2014 - 18:59:20 Folder 43 - Part 006 - Time stamp 1/1/2014 - 18:59:59

Extra function

Is there a way to do all the above but skip all folders that contain - GROUP VIDEO at the end of it. (I am not sure if I should create a new post or not?)

Answer1:

Test this:

@echo off setlocal enabledelayedexpansion set num=0 for /f "delims=" %%a in ('dir /b /ad /o-d ^|find /i /v "GROUP VIDEO" ') do ( set /a num+=1 set name=000!num! set name=!name:~-3! ren "%%a" "%%a - Part !name!" ) pause

Recommend

  • class file for org.bouncycastle.cert.ocsp.BasicOCSPResp not found
  • Get latest records in a data frame based on time stamp with condition
  • Select statement for xdoc query
  • ASP.NET MVC with JSON REST Webservics
  • finishActivity() - closing all activities with exact request code
  • Add watermark using Jquery File Upload
  • neo4j EntityNotFound prevents cypher match from working
  • php incrementing time stamp error?
  • Sorting a Directory before Looping Through - PowerShell
  • why flask sqlalchemy model query does not get newest records?
  • Sql - SELECT rows until the sum of a row is a certain value
  • CSS footer fixed position based on minimum height
  • UIView animation continues to run after a new view controller is pushed onto the stack
  • Gulp globbing excluding files then unexcluding not working as described
  • Is there a reliable tool for stepping through code while serving in foreman
  • Building assimp 3.2 does not work anymore
  • sqlite3_prepare_v2 is getting SQLITE_ERROR
  • Integer Linear Programming Java: Multiple Open Source and Commercial tools are available. Which one
  • Batch file to delete all folders in a directory except the newest folder
  • Is there a way to pivot a customer ID and a their most recent order dates?
  • ASP.NET, C# How to Pass a StringQuery to a custom SQL Command
  • Base Internationalization and “Could not find a storyboard named […]”
  • CRASH: *** -[__NSArrayM objectAtIndex:]: index 4294967295 beyond bounds [0 .. 9]
  • PHP UTF-8 to GB2312
  • to implement a spinner in angular2+
  • What's the name of this finding square root algorithm?
  • py4j.protocol.Py4JJavaError when selecting nested column in dataframe using select statetment
  • python: forcing relative imports to search from script file
  • Python 3.2.2, error(scripts to exe)
  • How to attach a node.js readable stream to a Sendgrid email?
  • Word Open XML Mail Merge
  • Test if a set exists before trying to drop it
  • Jquery - Jquery Wysiwyg return html as a string
  • SVN: Merging two branches together
  • Transpose CSV data with awk (pivot transformation)
  • Proper folder structure for lots of source files
  • Load html files in TinyMce
  • Append folder name and increment by 1 using batch script
  • Android Heatmap on canvas or ImageView
  • Conditional In-Line CSS for IE and Others?