Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Copy/Insert folder/s to the same root directory (of the same depth)

Posted on 2014-04-14
3
Medium Priority
?
297 Views
Last Modified: 2014-04-17
I have a Terminal Server with Windows Server 2003 and would like to implement a specific folder structure and force the users to stick to it. Problem comes in when creating new folders... If you grant the user the right to edit the structure you loose control all over again, but I am not prepared to add the same folder for 1000s of clients in the structure manually.

Is there a way that I can add/create the same folder in multiple  "Tax" subfolders for example. In the image attached I explained the structure: I have an existing clientfolder with multiple client folders, each client has multiple entities, but in each entity the folder structure remains the same. I would like to add the folder "2013" in red in the image to all the existing "Tax" folders at once.

I've searched for software, but could find none that could actually do what I want (explained above). There are software that can create folder structures or even copy existing structures like File Boss and 47 Folders.

I wondered if I could create a batch file to create these folders simultaneously?
DIRECTOR.gif
0
Comment
Question by:Bizfolio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 85

Accepted Solution

by:
oBdA earned 2000 total points
ID: 39998916
A simple batch script should do the trick; just set the search root to the actual path of the client folders, and save as Whatever.cmd. The script is currently in test mode and will only display the "md" commands it would normally run, so that you can test it. To run it for real, remove the uppercase "ECHO" in line 9.
@echo off
setlocal
set SearchRoot=D:\Client Folders
set SearchFolder=Tax
set AddFolder=2013
for /f "delims=" %%a in ('dir /s /b /a:d "%SearchRoot%\%SearchFolder%"') do (
	echo Processing '%%a' ...
	if not exist "%%a\%AddFolder%" (
		ECHO md "%%a\%AddFolder%"
		echo ... added folder '%AddFolder%'.
	) else (
		echo ... folder '%AddFolder%' already exists.
	)
)

Open in new window

0
 
LVL 85

Expert Comment

by:oBdA
ID: 39998917
A simple batch script should do the trick; just set the search root to the actual path of the client folders, and save as Whatever.cmd. The script is currently in test mode and will only display the "md" commands it would normally run, so that you can test it. To run it for real, remove the uppercase "ECHO" in line 9.
@echo off
setlocal
set SearchRoot=D:\Client Folders
set SearchFolder=Tax
set AddFolder=2013
for /f "delims=" %%a in ('dir /s /b /a:d "%SearchRoot%\%SearchFolder%"') do (
	echo Processing '%%a' ...
	if not exist "%%a\%AddFolder%" (
		ECHO md "%%a\%AddFolder%"
		echo ... added folder '%AddFolder%'.
	) else (
		echo ... folder '%AddFolder%' already exists.
	)
)

Open in new window

0
 

Author Closing Comment

by:Bizfolio
ID: 40006122
This worked like a charm. Thank you very much. It is a simple and very effective solution.
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Starting up a Project

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question