English Amiga Board


Go Back   English Amiga Board > Support > support.AmigaOS

 
 
Thread Tools
Old 20 December 2021, 14:50   #1
EctoOne
Registered User
 
EctoOne's Avatar
 
Join Date: Jun 2020
Location: Germany
Posts: 373
Rename file, get new name from file?

Hi,
not sure if this is the correct section or it would be better in Apps.

I'm looking for a way to read the new name for a file from a file/variable.
Something like this: http://aminet.net/package/util/cli/FileComment
But for renaming files.
I've tried stuff like:
Code:
Rename "OldName" <RAM:FileWithNewNameInIt
But it doesn't work.

I probably could write some scripts which uses http://aminet.net/package/util/cli/SRename(which can copy the file name to the comment and vice versa) and http://aminet.net/package/util/cli/readcomment (to export the comment), but I wouldn't mind a simpler way.

Now, that I think of it. Is there an easier way to copy a file name into a file/variable?

I'm using all the tools from above to copy the file name to the comment and then export the comment into a variable. Which I then import as comment in other files. I'm doing this for archives, so that I can trace from which archive the files came. If I could skip the step copying the name to the comment, that would be great too.
EctoOne is offline  
Old 20 December 2021, 14:56   #2
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 3,317
Quote:
Originally Posted by EctoOne View Post
I'm looking for a way to read the new name for a file from a file/variable.
From a file or a variable? If you want to take a name from a variable, just put the variable there:
Code:
 rename original $foo
and put the new name into foo before.

To take a new name from a file, learn about the backticks. They take the output of a file, and place it as argument on the line:
Code:
 rename original "`type file_containing_new_name`"
Thomas Richter is offline  
Old 20 December 2021, 15:20   #3
EctoOne
Registered User
 
EctoOne's Avatar
 
Join Date: Jun 2020
Location: Germany
Posts: 373
Wow, thanks for the quick help. It works great.
I have used backticks before, but not that much that I thought it would help here.

Also for my question about copying a file name to a file/variable, im using FilePart from the 0Utils package now.

Off to make some custom entries for DirOpus.
EctoOne is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to archive an lha file inside a new lha file Foebane support.Apps 6 11 December 2019 21:08
asm code file errors and external file locations Brick Nash support.WinUAE 0 06 April 2015 17:14
File .NFO & file ID.diz stuff.... How To..!! DC33 support.Other 4 11 March 2009 10:21
Running non .adf file, .info file?? ypestis New to Emulation or Amiga scene 5 29 March 2006 18:53
1 GB Harddisk file Anubis support.WinUAE 5 27 March 2006 14:39

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:26.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.06734 seconds with 15 queries