Command to move/rename files
-
@wilriker You could also use an FTP Session to do this! assuming you enable FTP Support that is.
Configure Network ProtocolsDoug
-
@dougal1957 Yeah, that would work, too. But I think "G-Code everywhere" should allow such a simple task. Also everything in source code is already present it just needs an outside interface.
-
Please check whether anything else uses M31 already, in particular the NIST CNC GCode standard and Marlin.
-
@dc42 Marlin does use
M31
to report current print time.The next unused M-Code according to https://reprap.org/wiki/G-code is
M50
. This is not used by Marlin or NIST CNC. It is though used by LinuxCNC and ReplicatorG according to a short research. -
M31 is "time since start of SD print" on Marlin and many others.
Perhaps, extend M33 instead. This is "get long name of file" in Marlin (and others) today.
-
@wilriker said in Command to move/rename files:
@dc42 Marlin does use
M31
to report current print time.The next unused M-Code according to https://reprap.org/wiki/G-code is
M50
. This is not used by Marlin or NIST CNC. It is though used by LinuxCNC and ReplicatorG according to a short research.In that case I suggest we allocate an unused (by RRF/NIST/Marlin) M-code in the 500 range or possibly the M400 range, assuming that M33-M35 are already taken (I expect they are, because I allocated M36).
-
@dc42 said in Command to move/rename files:
In that case I suggest we allocate an unused (by RRF/NIST/Marlin) M-code in the 500 range or possibly the M400 range, assuming that M33-M35 are already taken (I expect they are, because I allocated M36).
I need to check on NIST but
M470
is looking good so far. Will allocate it tomorrow then and provide a PR. -
Will it support renaming folders too?
-
@dragonn said in Command to move/rename files:
Will it support renaming folders too?
That's the plan.
Also I just coincidentally stumbled across a request of the same feature by @resam that also asked for a way to create a directory via GCode. I will also allocate a M-Code for that and include it in my PR. Both a fairly trivial to do.
-
@wilriker said in Command to move/rename files:
Currently there are only two ways to move or rename a file: use DWC (which is using an HTTP call underneath) or remove the SD card from the Duet and do it on a computer.
I propose an M-Code command to do the same. Looking at https://reprap.org/wiki/G-code there is nothing unused in the M20..M39 range but at least RRF is not using M31 so far.
This ties into my suggestion that files with "._" and ".DS_Store" should at the very least be hidden. For that matter any file that starts with a period should really be ignored. Anyone who frequently mounts the SD card in Windows or Mac will likely find these droppings all over the place. I'd be just as happy if the Duet deleted all of these files when the SD card is mounted, but I realize that's not likely to happen. I'm mostly referring these files appearing in the 12864 file list.
-
I reserved
M470
for creating a directory andM471
for moving/renaming files/directories. PR with implementation somewhen later today. -
@3dmntbighker said in Command to move/rename files:
This ties into my suggestion that files with "._" and ".DS_Store" should at the very least be hidden. For that matter any file that starts with a period should really be ignored. Anyone who frequently mounts the SD card in Windows or Mac will likely find these droppings all over the place. I'd be just as happy if the Duet deleted all of these files when the SD card is mounted, but I realize that's not likely to happen. I'm mostly referring these files appearing in the 12864 file list.
I am confused. RRF doesn't return files whose name begin with '.' to DWC. I have just tested this by uploading a menu file starting with '.' to a Maestro. It didn't appear in the file list after uploading it, even after pressing Refresh.
-
And here's the Pull Request.
-
@dc42 said in Command to move/rename files:
@3dmntbighker said in Command to move/rename files:
This ties into my suggestion that files with "._" and ".DS_Store" should at the very least be hidden. For that matter any file that starts with a period should really be ignored. Anyone who frequently mounts the SD card in Windows or Mac will likely find these droppings all over the place. I'd be just as happy if the Duet deleted all of these files when the SD card is mounted, but I realize that's not likely to happen. I'm mostly referring these files appearing in the 12864 file list.
I am confused. RRF doesn't return files whose name begin with '.' to DWC. I have just tested this by uploading a menu file starting with '.' to a Maestro. It didn't appear in the file list after uploading it, even after pressing Refresh.
I was referring to what I see in the 12864 directory list. Not the web console. When you go to print from the 12864 menus there are a bunch of these files littered everywhere that Windows must have left at some point. But I use a Mac.
-
@3dmntbighker said in Command to move/rename files:
a bunch of these files littered everywhere that Windows must have left at some point. But I use a Mac.
Just nitpicking: .DS_Store files are created by MacOS.
Solution: use Linux. It won't add any unwanted files to your SD card.
(Couldn't resist )
-
@wilriker said in Command to move/rename files:
@3dmntbighker said in Command to move/rename files:
a bunch of these files littered everywhere that Windows must have left at some point. But I use a Mac.
Just nitpicking: .DS_Store files are created by MacOS.
Solution: use Linux. It won't add any unwanted files to your SD card.
(Couldn't resist )
Hehe, I manage Linux systems for a living. But I use a Mac to get actual work done.
-
@3dmntbighker Fair enough. I use Linux everywhere and wouldn't want it any other way. One of my professors once said to me it all boils down to what system fits best to your way of thinking and expectations.
-
@wilriker said in Command to move/rename files:
@3dmntbighker Fair enough. I use Linux everywhere and wouldn't want it any other way. One of my professors once said to me it all boils down to what system fits best to your way of thinking and expectations.
For me, that would mean a slide rule and log tables
-
@deckingman said in Command to move/rename files:
For me, that would mean a slide rule and log tables
I guess that would restrict our future communication to traditional mail then.
-
@wilriker said in Command to move/rename files:
@deckingman said in Command to move/rename files:
For me, that would mean a slide rule and log tables
I guess that would restrict our future communication to traditional mail then.
Yes. Hand written with a quill, and sent by carrier pigeon.