8000 batch rename find/fd files · Issue #1214 · jarun/nnn · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

batch rename find/fd files #1214

New issue

Have a question about 8000 this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ixzh opened this issue Oct 30, 2021 · 22 comments
Closed

batch rename find/fd files #1214

ixzh opened this issue Oct 30, 2021 · 22 comments

Comments

@ixzh
Copy link
ixzh commented Oct 30, 2021

Is your feature request related to a problem? Please describe.

fd pdf ~/Downloads -0 | nnn can be used to show and open files, but batch rename r doesn't work.

Describe the solution you'd like

Would it be possible to make r operate on symlink list to rename target files? seems to be a natural extension of the r function.

@jarun
Copy link
Owner
jarun commented Oct 30, 2021

Press Left on the symlink and it will take you to the target file. Then rename it.

@jarun jarun closed this as completed Oct 30, 2021
@ixzh
Copy link
Author
ixzh commented Oct 30, 2021

Press Left on the symlink and it will take you to the target file. Then rename it.

That's good for an individual file. But if there are hundreds of files from different folders, rename them one by one is tedious. Use find to filter the list and batch rename accordingly is more practical I think.

@ixzh ixzh changed the title rename find/fd files batch rename find/fd files Oct 30, 2021
@jarun
Copy link
Owner
jarun commented Oct 30, 2021

While it's a regular use case for you, implementing it is roundabout - we have to find each target, add to a new buffer and then rename. Sorry, there is no ROI for us here.

@ixzh
Copy link
Author
ixzh commented Oct 30, 2021

Thanks anyway!

@N-R-K
Copy link
Collaborator
N-R-K commented Oct 30, 2021

@ixzh this use-case maybe better solved by some dedicated batch-ranamer script/program. There are quite a lot out there, although I haven't used any.

@ixzh
Copy link
Author
ixzh commented Oct 30, 2021

@ixzh this use-case maybe better solved by some dedicated batch-ranamer script/program. There are quite a lot out there, although I haven't used any.

you mean in the plugin listing? Or where can I find? I'm using the default scripts/.nmv.

@N-R-K
Copy link
Collaborator
N-R-K commented Oct 30, 2021

you mean in the plugin listing?

No, independent ones.

Or where can I find?

You can try searching for "batch renamer" in github. As I've said, I don't use any so I can't recommend one.

@ixzh
Copy link
Author
ixzh commented Oct 30, 2021

you mean in the plugin listing?

No, independent ones.

Or where can I find?

You can try searching for "batch renamer" in github. As I've said, I don't use any so I can't recommend one.

Ok, thank you! I will try to figure out a way.

@jarun
Copy link
Owner
jarun commented Oct 30, 2021

On second thoughts, @KlzXS do you think we can extend the batchrename script to rename the files in the current directory but apply to the symlink targets? We can see if we can figure a way to indicate to the script if this is a case of a listed directory.

@jarun jarun reopened this Oct 31, 2021
@jarun
Copy link
Owner
jarun commented Oct 31, 2021

If someone else wants to give it a try, we will need to rename the target for the symlink in plugin .nmv rather than the file itself to achieve this.

The main program can set an env var before calling .nmv to indicate that the current directory is in listing mode.

@KlzXS
Copy link
Collaborator
KlzXS commented Oct 31, 2021

We can do that. Make .nmv resolve symlinks if. Suggest a name for the env variable.

@jarun
Copy link
Owner
jarun commented Oct 31, 2021

$NNN_LIST

@jarun jarun removed the wontfix label Oct 31, 2021
@jarun
Copy link
Owner
jarun commented Nov 3, 2021

Resolved at commit 470c777.

@ixzh please confirm the fix.

@jarun jarun closed this as completed Nov 3, 2021
@jarun
Copy link
Owner
jarun commented Nov 3, 2021

Please test with commit eb769c0 as I have made a minor modification.

@jarun jarun mentioned this issue Nov 3, 2021
17 tasks
@ixzh
Copy link
Author
ixzh commented Nov 3, 2021

Thank you for the workout!! I have tested the following, and the files are missing after renaming their symbolic links in list mode:

  1. I put 3 files in the following place
    image

  2. and start nnn using fd . ~/Downloads/Telegram\ Desktop/ -0 | nnn
    image

  3. and r batch rename by prepending a number in Vim
    image
    becomes:
    image

  4. and :wq, the listing now shows 3 files and 3 symbolic links
    image

  5. pressing q, and the target files are gone.
    image

I also tried fd . ~/Downloads/Telegram\ Desktop/ -0 | NNN_LIST=1 nnn in step 2, same result.

So are the files removed from disk by doing the above? I can't locate them in my system.

Another issue:
the getplugs plugin seems to download an outdated zip.

@KlzXS
Copy link
Collaborator
KlzXS commented Nov 3, 2021

the getplugs plugin seems to download an outdated zip

By default it downloads a zip that goes with the version of nnn. To download from master run it as getplugs master.

@ixzh
Copy link
Author
ixzh commented Nov 3, 2021

the getplugs plugin seems to download an outdated zip

By default it downloads a zip that goes with the version of nnn. To download from master run it as getplugs master.

I see. I'll amend my plugin command. Thanks!

@KlzXS
Copy link
Collaborator
KlzXS commented Nov 3, 2021

I can see where the problem is. For now use it only with selection.

@jarun jarun mentioned this issue Nov 4, 2021
@ixzh
Copy link
Author
ixzh commented Nov 9, 2021

hey
since commit #1508874, .nmv seems not to work for 'c'urrent :
image

I changed the leading 0s to .s, also can't save the changes.

@jarun
Copy link
Owner
jarun commented Nov 10, 2021

@KlzXS can you please take a look?

@KlzXS
Copy link
Collaborator
KlzXS commented Nov 10, 2021

See #1232. I hope this ends the whole saga.

@ixzh
Copy link
Author
ixzh commented Nov 11, 2021

thank you! it works.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants
0