making folder from CNC program names?
Moderators: Hacker, petermad, Stefan2, white
-
- Junior Member
- Posts: 29
- Joined: 2015-10-20, 20:00 UTC
- Location: poughkeepsie ny
So far, with your help, I have accomplished the most important aspect of this project, but I need to continue on and have met another stumbling block I need help with. I hope I am being clear with what I am about to ask, but not knowing how to do it may also mean I am not sure how to ask the question. I thank you for your patience.
I have a path as follows F:\CNC Programs\JD\121\
In the \121\ folder I have many other folders with individual part numbers
such as 121-00-00-9014 i.e. the path would be F:\CNC Programs\JD\121\121-00-00-9014:
Inside th121-00-00-9014 folder I have five folders, MCX, POST, SOLIDS,PDF AND SETUPSHEETS.
I have another path F:\CNC Programs\Mill\MCX-files\121
Inside this last folder I have all my mastercam files beginning with 121 such as
121-00-00-9014 R00.MCX.
What I would like to do is take all the .MCX files from the F:\CNC Programs\Mill\MCX-files\121, file
and using the first fourteen characters of the individual MCX files, copy them into the corresponding
F:\CNC Programs\JD\121\*.*\MCX folders. So, using the above example
The file 121-00-00-9014 R00.MCX would get copied into the F:\CNC Programs\JD\121\121-00-00-9014\MCX folder.
A file 121-25-35-001 R01.MCX would get copied into the F:\CNC Programs\JD\121\121-25-35-0001\MCX folder, and so forth
I can only do this one at a time now and need to find a quicker way.
Once again I have thousands of file to do this to.
I would like to make shortcuts for other files with different extensions and put them in folders using the same method.?
Any Help would be greatly welcome
Thank You
Jerry Dragon
I have a path as follows F:\CNC Programs\JD\121\
In the \121\ folder I have many other folders with individual part numbers
such as 121-00-00-9014 i.e. the path would be F:\CNC Programs\JD\121\121-00-00-9014:
Inside th121-00-00-9014 folder I have five folders, MCX, POST, SOLIDS,PDF AND SETUPSHEETS.
I have another path F:\CNC Programs\Mill\MCX-files\121
Inside this last folder I have all my mastercam files beginning with 121 such as
121-00-00-9014 R00.MCX.
What I would like to do is take all the .MCX files from the F:\CNC Programs\Mill\MCX-files\121, file
and using the first fourteen characters of the individual MCX files, copy them into the corresponding
F:\CNC Programs\JD\121\*.*\MCX folders. So, using the above example
The file 121-00-00-9014 R00.MCX would get copied into the F:\CNC Programs\JD\121\121-00-00-9014\MCX folder.
A file 121-25-35-001 R01.MCX would get copied into the F:\CNC Programs\JD\121\121-25-35-0001\MCX folder, and so forth
I can only do this one at a time now and need to find a quicker way.
Once again I have thousands of file to do this to.
I would like to make shortcuts for other files with different extensions and put them in folders using the same method.?
Any Help would be greatly welcome
Thank You
Jerry Dragon
You could move them with this MRT mask:
For stuff like this a little script is often more flexible.
For example in PowerShell:
Code: Select all
..\..\..\JD\121\[N1-14]\MCX\[N]
For example in PowerShell:
Code: Select all
$sourcePath = "f:\CNC Programs\Mill\MCX-files\121\"
$destinationPath = "f:\CNC Programs\JD\121\"
$sourceFiles = Get-ChildItem -Path $sourcePath
foreach ($file in $sourceFiles)
{
$first14Chars = $file.Name.Substring(0,14)
$finalDestination = $destinationPath + $first14Chars + "\MCX\"
Copy-Item -Path $file.FullName -Destination $finalDestination
}
dragonworks,
Again, you can move them all using branch view (Ctrl+B, then Num+, *.mcx) or search results window (Find files, *.mcx, Feed to listbox, select all) together with MRT, e.g. as ZoSTeR suggested, but this will move files, not copy.
Or you can select these files and copy them first (e.g. my CopyTree plugin allows copying from multiple folders with directory structure) and then move copies with MRT.
BTW you can also get 121 as [N1-3], just in case if you have another folders like 121 waiting for processing.
Again, you can move them all using branch view (Ctrl+B, then Num+, *.mcx) or search results window (Find files, *.mcx, Feed to listbox, select all) together with MRT, e.g. as ZoSTeR suggested, but this will move files, not copy.
Or you can select these files and copy them first (e.g. my CopyTree plugin allows copying from multiple folders with directory structure) and then move copies with MRT.
BTW you can also get 121 as [N1-3], just in case if you have another folders like 121 waiting for processing.
-
- Junior Member
- Posts: 29
- Joined: 2015-10-20, 20:00 UTC
- Location: poughkeepsie ny
Going to get the IT guy in on this again and go through this. I need to keep him abreast of what I am doing in case I run into trouble. We have an outside source backing us up and can retrieve just about anything as long as I know I lost it.
MVV, I used [N1-5] to move my Mpart and Kpart programs which have 5 initial characters instead of 14, worked well.
I have forgotten almost all the dos commands I ever knew and have downloaded dos instructions to browse over again. Only so many hours in the day. Most of the time I am programming for or setting up CNC machines. This is a project I took upon myself to help streamline the file management of this department.
Thanx all again.
Jerry
MVV, I used [N1-5] to move my Mpart and Kpart programs which have 5 initial characters instead of 14, worked well.
I have forgotten almost all the dos commands I ever knew and have downloaded dos instructions to browse over again. Only so many hours in the day. Most of the time I am programming for or setting up CNC machines. This is a project I took upon myself to help streamline the file management of this department.
Thanx all again.
Jerry
-
- Junior Member
- Posts: 29
- Joined: 2015-10-20, 20:00 UTC
- Location: poughkeepsie ny
this looks like it might work also, I can follow it to an extent, not sure if this is exactly what to type in, for instance,=Get-ChildItem- etc. is this a command or an example?ZoSTeR wrote:You could move them with this MRT mask:For stuff like this a little script is often more flexible.Code: Select all
..\..\..\JD\121\[N1-14]\MCX\[N]
For example in PowerShell:Code: Select all
$sourcePath = "f:\CNC Programs\Mill\MCX-files\121" $destinationPath = "f:\CNC Programs\JD\121" $sourceFiles = Get-ChildItem -Path $sourcePath foreach ($file in $sourceFiles) { $first14Chars = $file.Name.Substring(0,14) $finalDestination = $destinationPath + $first14Chars + "\MCX" Copy-Item -Path $file.FullName -Destination $finalDestination }
And, power shell, is that the black box for dos commands?
I would prefer PowerGUI if we talk about PowerShell GUI environment.
But if we just want to run PowerShell script from command line, the script should be saved as .PS1 file and run using this command line:
This may be done from console window or just from TC buttonbar button (start path field must be empty for that button in order to start script from currently opened dir).
But if we just want to run PowerShell script from command line, the script should be saved as .PS1 file and run using this command line:
Code: Select all
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "script.ps1"
-
- Junior Member
- Posts: 29
- Joined: 2015-10-20, 20:00 UTC
- Location: poughkeepsie ny
[quote="ZoSTeR"]You could move them with this MRT mask:
Well, either I did that wrong, or it didn't work. I forgot to copy the files to the desktop and I deleted them without thinking, oh well, you win some you lose some. If we make those parts again I will have to program them over again!
When you delete something using TC where does it go? I expected to find the folder and files in the recycle bin, but NOOOOO.
Code: Select all
..\..\..\JD\121\[N1-14]\MCX\[N]
When you delete something using TC where does it go? I expected to find the folder and files in the recycle bin, but NOOOOO.
You should check paths and names that TC shows in resulting column, every ".." means move one level up so it is not hard to evaluate target folder...Well, either I did that wrong, or it didn't work.
By default TC deletes to Recycle bin, but it may be changed in Copy/Delete settings.When you delete something using TC where does it go?
-
- Junior Member
- Posts: 29
- Joined: 2015-10-20, 20:00 UTC
- Location: poughkeepsie ny