Making Multiple empty (sub)folders at once

Discussion, questions and support.
Post Reply
Message
Author
gtaus1
Posts: 8
Joined: 01.10.2015, 21:05

Making Multiple empty (sub)folders at once

#1 Post by gtaus1 » 11.01.2016, 21:00

Can FC make multiple empty (sub)folders with sequential date counter? For example, I organize some downloaded radio programs into subfolders for every day of the year. So, file structure looks like: /Program_Name/2016/2016-01/2016-01-01. I find this approach to organizing the files helps me locate the files for any specific date very fast. Making 365 sub folders for each radio program is a time burner, so I was wondering if there was a way in FC to do it automatically this year.

I use FC for just about everything, so my first choice is to stay within the FC program, if possible. If not possible with FC, I have found a program called Text2Folders that may make the process of creating multiple (sub)folders faster, but still not really automated.

Any suggestions appreciated, including suggestions on organizing my files if there is a better approach than what I am currently doing by date. Thanks in advance.

User avatar
Dreamer
Site Admin
Posts: 6118
Joined: 19.08.2007, 23:40

Re: Making Multiple empty (sub)folders at once

#2 Post by Dreamer » 13.01.2016, 00:15

Workaround...

- manually create few folders
- select all and use ctrl+c / ctrl+v to create copies, to create 31 folders
- select all - ctrl+a
- F2
- as file name type: 2016-01-[c]
- use Digits: 2
- disable "only files"
- Enter

Result should be 31 folders with the file name 2016-01-01 - 2016-01-31.

Then copy/paste these folders, select all, F2, for file name use: 2016-02-[c] ...

gtaus1
Posts: 8
Joined: 01.10.2015, 21:05

Re: Making Multiple empty (sub)folders at once

#3 Post by gtaus1 » 13.01.2016, 04:04

Thanks for the feedback. Like you suggested, I have been doing it manually in FC, using copy, paste, and then bulk rename tool. I was just looking for a better, more efficient, automated method. FC does so much, but I know it cannot do everything.

While looking around for a better alternative, I thought about a new workaround that is a little better than the old copy, paste, rename method. I used Open Office Calc (the spreadsheet program) and set the first column to date format YYYY-MM-DD with the first day of this year, i.e. 2016-01-01. Then I selected that cell and dragged the cursor down which automatically started auto-filling each new date in the cells below. i.e. 2016-01-02, 2016-01-03, etc.... The Calc program automatically knows how many days are in each month, and also accounts for leap years. In a few seconds of dragging the cursor down, I had filled in over 3 years worth of dates in the column. Then I copied those data cells into Notepad and saved everything as a text file. Next I used the Text2Folder program I mentioned in my original post with that text file. The Text2Folder program created all 3 years of date subfolders in a just a few seconds. Really nice little utility program.

I saved those subfolders in a "template" folder so I can just copy the entire directory with subfolders to each target program I archive. So, I am pretty much done with that project for the next 3 years....

BTW, I use Open Office all the time but had never thought of using that auto-fill feature to create directories in Calc. Actually, it was the Text2Folder program that made it possible to complete the task. Both programs are free if anyone is interested. Great additions to FC in your utility toolbox.

stephen147
Posts: 370
Joined: 18.10.2015, 16:44

Re: Making Multiple empty (sub)folders at once

#4 Post by stephen147 » 15.07.2019, 15:09

Here, I came to the forum just wanting the same thing only just to create some blank folders so I knocked this up.

Just save it in FCs settings folder so it won't get lost if you use a portable build and create a new toolbar for this after saving it to something like DOS - Make Directories or something of that nature.

Here's the code with the date formatted as you want. This I had to get from here but the remainder of the code is my own and free for anyone to modify or use.

Make sure you save the .bat file as UTF-8.

Just let me know if you need any help.

Code: Select all

@echo off
rem mode con:cols=15 lines=1
color 5F
setlocal
chcp 65001 >NUL
set verNumber=1.2
::::::::::::::::::::::::::::::::::::::::::::::::
:: HISTORY OF CHANGES
:: 2019.07.15 - v1.0  - Created by stephen147.
:: 2019.07.15 - v1.1  - ADDED - Question 3 to ask user if it's a string or a date the user wants as the filename.
:: 2020.01.20 - v1.2  - BUG FIX - Fixed an issue with directing to the drive letter.
::::::::::::::::::::::::::::::::::::::::::::::::
:: HOW TO USE / ABOUT
:: Save the file to something like: `DOS - Make Directories.bat`.
:: Place the file in the folder you would like to create these folders.
:: OR, create a new toolbar in FreeCommander and point to this file which is best placed in the %FcSrcPath% of FreeCommanders' install location.
:: Forum link for batch file here: https://freecommander.com/forum/viewtopic.php?f=18&t=7065&p=30109#p30109
::::::::::::::::::::::::::::::::::::::::::::::::
:: ADDITIONAL NOTES
:: I shall not be held reliable should this code or program cause any issues whatsoever on your machine.
:: Use at your own risk.
:: Having said that, it only uses the md command so it shouldn't do anything apart from try to do that function.
::::::::::::::::::::::::::::::::::::::::::::::::
:: Visit this thread to find out the date formatting: https://stackoverflow.com/a/10945887/8262102
for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined localDate set localDate=%%x
set todaysDate=%localDate:~0,4%-%localDate:~4,2%-%localDate:~6,2%
title Version %verNumber% of ' %~nx0 ' by stephen147.
echo --------------------------------------------
echo Version %verNumber% of ' %~nx0 '
echo --------------------------------------------
echo/
echo README
echo Enter a value and this routine will then create the same amount of folders.
echo/
echo --------------------------------------------
echo/
echo CURRENT DIRECTORY
%~d1
cd "%~1"
echo Your directory is: "%~1"
echo/
echo --------------------------------------------
echo/
echo OPTIONS
goto FOLDER_USER_INPUT
:FOLDER_USER_INPUT
set "folderValDefault=10"
set "msg=Folder count set to:"
set /p "folderValInput=͏[Opt 1 of 3] Type the number of folders to create between. Press [ENTER] for default: [%folderValDefault%]: "
if not defined folderValInput (
  set "folderValInput=%folderValDefault%"
  echo ^>%msg% %folderValDefault%.
  echo/
  goto STEPUSERINPUT
  )
echo %folderValInput%|findstr /r /c:"[0-9]*" >NUL
if errorlevel 1 (goto FOLDER_USER_INPUT) else (
  echo ^>%msg% %folderValInput%.
  echo/
  goto STEPUSERINPUT
  )
:STEPUSERINPUT
set "stepValDefault=1"
set "msg=Step count set to:"
set /p "stepValInput=͏[Opt 2 of 3] Type the number folder steps. Press [ENTER] for default: [%stepValDefault%]: "
if not defined stepValInput (
  set "stepValInput=%stepValDefault%"
  echo ^>%msg% %stepValDefault%.
  echo/
  goto TEXTUSERINPUT
  )
echo %stepValInput%|findstr /r /c:"[0-9]*" >NUL
if errorlevel 1 (goto STEPUSERINPUT) else (
  echo ^>%msg% %stepValInput%.
  echo/
  goto TEXTUSERINPUT
  )
:TEXTUSERINPUT
set "textValDefault=%todaysDate%"
set "msg=Text string set to:"
set /p "textValInput=͏[Opt 3 of 3] Type text string. Press [ENTER] for default: [%todaysDate%]: "
if not defined textValInput (
  set "textValInput=%textValDefault%"
  echo ^>%msg% %textValDefault% + counter.
  echo/
  goto START_MAIN_ROUTINE
  )
echo %textValInput%|findstr /r /c:"\s*" >NUL
if errorlevel 1 (goto TEXTUSERINPUT) else (
  echo ^>%msg% %textValInput% + counter.
  echo/
  goto START_MAIN_ROUTINE
  )
:START_MAIN_ROUTINE
:: CD to current drive
echo Making new folders in: "%~1"
for /L %%A in (1,%stepValInput%,%folderValInput%) do (md "%textValInput% %%A") && echo ┼ New folder created: %textValInput% %%A
set /p "=" <NUL
timeout /t 6
exit
EDIT: Minor edit to the code. Now supports custom filename or date option as before.

SC of toolbar settings:

Image
Sceenshots made easy with ShareX.

Post Reply

Who is online

Users browsing this forum: No registered users and 43 guests