Automatically checking the existence of folders in a path - windows

I have a lot of folders, each folder has someone's surname as the name. I want to move all these surname folders into a different path, how would I automatically check the path I want to move them to, for the same name.
For example. Let's say in C:/Downloads I have a folder called Nunes. How would I make it so when I upload another folder called nunes, it alerts me that that folder already exists?

Related

Create new file in EnvDTE.SolutionFolder without specifying full path

The EnvDTE80.SolutionFolder interface (https://learn.microsoft.com/en-us/dotnet/api/envdte80.solutionfolder) has an AddFromFile() method, but requires the absolute full path of an existing file. Unfortunately the solution folder object itself doesn't contain a property with the path of the folder on disk.
Is there an easy way to create a new (text) file in a SolutionFolder without needing to know it's full absolute path? We just want a new file which is a direct child of the folder.
Something like this:
EnvDTE80.SolutionFolder folder;
var file = folder.CreateFile("myFile.txt");
But not:
EnvDTE80.SolutionFolder folder;
var file = folder.AddFromFile("c:\path_to_folder\myFile.txt");
Unfortunately the solution folder object itself doesn't contain a property with the path of the folder on disk.
Exactly. It's because the solution folders are virtual, they are not related to any physical folders in the file system. You can have "MyFolder" solution folder in your solution and no "MyFolder" in you file system.
You CAN have also the physical folder just for the convenience:
C:\Solution
MyFolder
myFile.txt
But even then, this physical folder is absolutely unrelated to the solution folder. The solution folder may contain files from anywhere, even from outside the solution root physical folder. That's why you must supply the full path if you want to add a file to a solution folder.
If you know that you have the structure of solution folders mirrored also in physical folder structure, you can construct the full path manually. Get the directory name of the solution with EnvDTE80.Solution.FullName, combine it with the EnvDTE80.SolutionFolder.Parent.Name and then with the file name.

Replacing a files into multiple folders/subdirectories

Is there a way in command prompt to take files and replace it into another folder and it's sub directories based on it's name?
I have an images in my folder and i have folder have sub directories that have the same name of images, what i want to do i need to replace the image in the sub directories base on the image in my main folder.
I searched for other similar questions and I found a few topics that might interest you.
Batch file to move files based on name w/o creating new folders
Batch Create a Folder Based on Filename, and Move Multiple Related
Files to The Created Folder
If you post the code you have already tried, it may be possible to fix any issues you are having.

how to predict the name of zip folder generated by windows?

I am going to prepare a (windows) server side service which allows users to download their requested files as a Zipped folder. In Microsoft windows(7) If you select all files and folders and send them to a zip folder, a random name will be assigned to the generated zip file which is the name of one files or folders in that collection.
Is there any reason that windows doesn't set a new name say new-zip-file? and how can I predict what the name would be?
The name of the zip is in fact not random,
it relies in the file you choose to click at last.
you can select multiple files but you make right click on one only file in order to zip the group of files, and thats the file name windows chooose.

Create folder in selected folder with OS X Automator

I am trying to batch convert a bunch of raw image files on OS X. I would like to use built-in software since it is possible.
First I would like to
let the user select the input folder containing the raw files;
create a new folder jpgs inside of that folder;
copy the raw files from the user selected folder into jpgs.
This is the workflow I have implemented so far in order to implement the first two steps.
First I let the user select a folder and store it into the variable NEF Folder. The I create a new folder named jpgs in the folder chosen by the user (NEF Folder).
BUT this is what the workflow does after selecting folder AAA on the Desktop:
Why?
Understood.
The action New folder creates a folder and copies its input inside of the newly created folder.
I have the same issue and solved it checking the box "Ignore this action's input".

How can I determine which folder the user was browsing when my program was invoked from the "sent to" menu?

I put a shortcut to my application in SendTo. Now I can select some files in Explorer and send them to my application. But how can I get the path where the files are? My program is supposed to create a new file in the parent directory that's common to all the received file names.
For example, if I have these files:
C:\one.txt
C:\1\
I select the file one.txt and the directory 1 in Explorer. How can I find out that the starting directory for these files is C:\?
I know I can use ParamStr() to get files' paths, but what then?
I could try to get common directory for all the files passed to my application, but if I select in C:\ directories 1 and 2 and these directories look like this:
C:\1\4\5\one.txt
C:\1\4\two.txt
Then the starting directory is C:\1\4.
Prior to Windows 7, all files selected in Explorer always reside in the same directory, so it's easy to know which directory the user was browsing. It's the same as the directory of any one file. Use ExtractFilePath for that.
As of Windows 7, though, Explorer lets you put directories into groups called libraries. All the files from all the folders are displayed together in a single view. Users can select files from multiple directories and send them all to your program at once. The view doesn't represent any real directory on the disk, so the question asked here is meaningless.
As an alternative, you could decide use the ancestor directory common to all the files sent to your program, but that won't tell you much. For one thing, if the files reside on multiple drives, the common directory will be the empty string. The directory you calculate also might not be writable by the current account, even if the directories of one or more of the selected files are.
It will probably be easier to just use the directory of the first file you receive, or even to display a UI that asks the user what directory to use in the cases you can't determine it automatically. (Maybe you could pre-populate the result with the first directory, so the user doesn't have to do anything but approve your suggestion in the common case.)
I think I will just take all the filenames passed to my program via ParamStr and use this function:
http://delphi.about.com/od/delphichallengesexercises/qt/delphi-extract-base-path-challenge.htm
to find common base path which should be the path where the SendTo was invoked.

Resources