Search found 31 matches

by machone
09 Dec 2012 19:46
Forum: DOS Batch Forum
Topic: How to create a folder inside all first-level subfolders?
Replies: 19
Views: 13888

Re: How to create a folder inside all first-level subfolders

Thanks! I had come up with this, which seems to work so far:

@echo off
for /d %%a in ( ".\*" ) do (
md "%%a\temp" 2>nul
)

Do you see any potential issues with the way I arrived at the solution?
by machone
09 Dec 2012 19:25
Forum: DOS Batch Forum
Topic: How to create a folder inside all first-level subfolders?
Replies: 19
Views: 13888

How to create a folder inside all first-level subfolders?

I've got a directory structure with a main folder and several levels of subfolders. I need to be able to create a same-named folder (i.e. \temp\) in every subfolder (1 level down) but not in any sub-subfolders (2+ levels down). I've been trying different approaches with no luck so far.. Does anyone ...
by machone
11 Nov 2012 08:57
Forum: DOS Batch Forum
Topic: How to do recursive dir listing in first level only
Replies: 3
Views: 5679

Re: How to do recursive dir listing in first level only

Thanks foxidrive and dbenham. Yes, I know it's not technically a csv list. I was just naming it that way because my next step is to open the results in a text editor and clean and restructure them using regex, the end result being an actual comma separated list. I was just naming it that way for cla...
by machone
10 Nov 2012 19:17
Forum: DOS Batch Forum
Topic: How to do recursive dir listing in first level only
Replies: 3
Views: 5679

How to do recursive dir listing in first level only

Hi, I'm starting with the following dir command: dir /s /t:w "constant_string* 01.txt" "constant_string* 01.csv" > list.csv to catch all instances of txt and csv files which have an " 01" at the end of their filenames, and output the list to a csv file. However, I need ...
by machone
07 Oct 2012 08:50
Forum: DOS Batch Forum
Topic: Glitch while trying to copy files to subdirs and rename
Replies: 11
Views: 5669

Re: Glitch while trying to copy files to subdirs and rename

Thanks foxidrive, will do some testing on this later today.. I presume the ~15 is the number of characters to strip from the name when the file is copied, right?
by machone
05 Oct 2012 14:08
Forum: DOS Batch Forum
Topic: Glitch while trying to copy files to subdirs and rename
Replies: 11
Views: 5669

Re: Glitch while trying to copy files to subdirs and rename

How would you do this process in reverse for a group of folders? For example, a folder structure like so: \toplevel\random folder name\backup\CONSTANT_STRING rest of filename.ext What I need to do is take the "CONSTANT_STRING rest of filename.ext" file and copy it up one level (i.e. from \...
by machone
04 Oct 2012 04:10
Forum: DOS Batch Forum
Topic: Glitch while trying to copy files to subdirs and rename
Replies: 11
Views: 5669

Re: Glitch while trying to copy files to subdirs and rename

Thanks foxidrive. I didn't even realize that it would create the Deprecated folder in every folder, since every folder in my particular scenario actually has the 'CONSTANT_STRING' file in it, so in my situation it wouldn't have mattered. But having the more refined example you provided is definitely...
by machone
03 Oct 2012 18:06
Forum: DOS Batch Forum
Topic: Glitch while trying to copy files to subdirs and rename
Replies: 11
Views: 5669

Re: Glitch while trying to copy files to subdirs and rename

Nice, thanks! That seems to work so far.. now for some more testing.
by machone
03 Oct 2012 17:49
Forum: DOS Batch Forum
Topic: Glitch while trying to copy files to subdirs and rename
Replies: 11
Views: 5669

Re: Glitch while trying to copy files to subdirs and rename

Try to use a nested loop. Untested: for /d %a in (*) do @for %b in ("%a\CONSTANT_STRING*.ext") do @copy "%b" "%a\Deprecated\DEP %~NXb" This method names the file properly (doesn't overwrite the name) but only creates the file if the \Deprecated\ folder already exists. ...
by machone
03 Oct 2012 14:11
Forum: DOS Batch Forum
Topic: Glitch while trying to copy files to subdirs and rename
Replies: 11
Views: 5669

Glitch while trying to copy files to subdirs and rename

I'm working on a set of directories, all with varying names. Each directory contains a file with a constant string in its name which I'm using to filter on. Wherever those files with constant strings in their names exist, I need to create a subdirectory called "Deprecated" and copy the fil...
by machone
02 Oct 2012 09:21
Forum: DOS Batch Forum
Topic: How to copy and rename subfolders under variable folders?
Replies: 11
Views: 6403

Re: How to copy and rename subfolders under variable folders

Ah, ok, that might be an issue in the longrun, since some of the paths are long (product names and series numbers). I plan to test it on a batch of 250 folders later today and see if it finishes without error. I also plan to test abc0502's method on the same sample set and see if it's noticeably fas...
by machone
02 Oct 2012 06:08
Forum: DOS Batch Forum
Topic: How to copy and rename subfolders under variable folders?
Replies: 11
Views: 6403

Re: How to copy and rename subfolders under variable folders

:) Cool. Thanks for the example though. I can look through it and try to learn other ways of doing it.
by machone
02 Oct 2012 05:39
Forum: DOS Batch Forum
Topic: How to copy and rename subfolders under variable folders?
Replies: 11
Views: 6403

Re: How to copy and rename subfolders under variable folders

I'll give it a try this morning, thanks. But are there any advantages with yours over mine? I've tested this one, and it works: for /d %%a in ("e:\0-TESTING\*") do @xcopy "%%~Fa\PSD\*" "%%~Fa\PSD_2" /I /E 2>NUL and it's only 1 line as opposed to your 11 lines... (And ye...
by machone
02 Oct 2012 04:43
Forum: DOS Batch Forum
Topic: How to copy and rename subfolders under variable folders?
Replies: 11
Views: 6403

Re: How to copy and rename subfolders under variable folders

Hmm.. does that offer any advantages over mine? You seem to be "hard-coding" into a batch file the folders in which it'll operate, whereas mine will travel the directory structure until its done. In my real-world situation this needs to work on over 1600 project folders with more being add...
by machone
01 Oct 2012 19:24
Forum: DOS Batch Forum
Topic: How to copy and rename subfolders under variable folders?
Replies: 11
Views: 6403

Re: How to copy and rename subfolders under variable folders

Actually, I think I got it, unless someone can point out potential issues I'm not foreseeing... for /d %%a in ("e:\0-TESTING\*") do @xcopy "%%~Fa\PSD\*" "%%~Fa\PSD_TEMP" /I 2>NUL EDIT: Ah, well, one thing I've found so far is if the original PSD folder has its own subfo...