Code Monkey home page Code Monkey logo

Comments (5)

nbehrnd avatar nbehrnd commented on June 14, 2024

from move2archive.

DeutscheGabanna avatar DeutscheGabanna commented on June 14, 2024

I don't recall if years new to move2archive have to be
defined once manually

Like, in the source code of move2archive.exe?
And what about m2a not being able to find *png when clearly there's at least one file in the C:\...\Downloads folder (current path from which I'm starting this command)

from move2archive.

nbehrnd avatar nbehrnd commented on June 14, 2024

During the installation move2archive, the program defines a default path where files will be stored provided they already possess a date2name timestamp including a year. Because the address of this repository will vary (dependent on the operating system), I recommend to i) install move2archive, and ii) to check the program's work by move2archive --help run from the CLI (In Windows, the shell named cmd.exe). If successful, this lists the parameters available. It equally will state the address the program assumes if not instructed differently -- see «options» with --archivepath=DIR. In my case (Linux operating system), it reads

  --archivepath=DIR     overwrite the default archive base directory which
                        contains one subdirectory per year. DEFAULT is
                        currently "/home/norwid/archive/events_memories"
                        (which can be modified in
                        "/usr/local/bin/move2archive")

-- but it equally will adjust to the Windows operating system and your user name -- but the archive directories are not the storage of the executable of move2archive. Have a look on the tree-like diagram in Karl's blog post My folder hierachy which was beneficial for me in this related issue report: every year has its own subfolder.

167286947-6ef9d728-fc84-4612-ba9b-1e8ec4ed2a8e

My suggest:

  • Check if the installation of move2archive was successful, either move2archive --help, or m2a --help should display the help menu.
  • Check if the archive path is mentioned at all when running move2archive --help. If events_memories as subfolder to archive is missing, add it manually.
  • Create 2022 as subfolder to archive/events_memories to accommodate files by 2022. Test if a simple test file (such as an empty test.txt) gets its stamp by date2name. If affirmative, test move2archive on this 2022-12-15_test.txt.
  • next level: create a cheap test file (like empty test.txt) and add a time stamp (date2name), then a tag (filetags) before stashing it into the archive. This sequence aims to verify that the empty spaces in the file name filetags adds are compatible to your setup of Windows. (It shouldn't be a problem anymore, but better to check the engines gradually.)
  • repeat the sequence with a simple .png. (However, if you want to process multiple at once, a joker like *.png is safer than *png).

from move2archive.

novoid avatar novoid commented on June 14, 2024

@DeutscheGabanna Sorry for your journey. Yes, the README can be improved - as always. Let's think about something that should explain it better for people who are not that familiar with the shell.

I'd like to reply to your initial message. Not to for shame but for comparing how my personal idea would have been how the user experience develops. Maybe we both learn something from that.

First of all, you should provide the version you're using. If you want to make sure I can understand your situation, you should also provide me the operating system and its version. From the paths you're using, I assume you're running a Windows system.

Just my two cents from a perspective of a guy that somewhat knows working in command-line, but it's not my primary area of computer use and file browsing. Also using scripts is not my forte.

Unfortunately, this tool requires at least knowledge on how to use command line tools. That's the target group and this most probably won't change for this tool in the future.

1. I try to invoke `m2a --help` to see where do you put source directory. But help only mentions target directory. A couple of head scratches later I have a moment of revelation! It probably requires a folder specified right after `m2a`.

Perfect, you've started with the help screen.

My first attempt - failed:

m2a . --archivepath="G:\My Drive\archive"
ERROR    item "." has got no valid datestamp! Can not process this item.

I'm a little puzzled here. You've found the help screen and from the looks of it you did not get the usage (right at the top):

Usage:                                                                                                             
    /home/vk/bin/m2a <options> <file(s)>  

You first attempt provided the option or file "." which is not a known one.

How would you prefer an improvement here? Are the concepts of options and files something I need to describe? I would have assumed that those are familiar terms for people using shell scripts.

On non-Windows systems, "." is a shortcut to "the current directory". You may have mixed up something?

My second attempt - failed:

m2a *.jpg --archivepath="G:\My Drive\archive"
ERROR    File/Folder "*.jpg" does not exist! Aborting.

I can not reproduce this behavior.

vk@sting ~/src/m2a/test (git)-[master] % m2a --dryrun *.notexisting
zsh: no matches found: *.notexisting
vk@sting ~/src/m2a/test (git)-[master] % m2a --dryrun *.notexisting --archivepath="/not/existing/"
zsh: no matches found: *.notexisting
vk@sting ~/src/m2a/test (git)-[master] %

I don't know what happened here. If you're switching the order of options and files, that should be fine.

If you're referring to files that don't exist, this should result in an error of your shell environment.

If you're using wildcards "*.jpg", the shell should expand the wildcards before m2a gets the parameter list.

If you're using an archivepath that doesn't exist, the script should give you help:

vk@sting ~/src/m2a/test (git)-[master] % m2a --dryrun * --archivepath="/not/existing/"
INFO     Option "--dryrun" found, running a simulation, not modifying anything on file system:
ERROR    

The archive directory "/not/existing/" is not a directory!
modify default setting in "/home/vk/bin/m2a" or provide a valid directory with command line option "--archivepath".

    press <Enter> to quit
1 vk@sting ~/src/m2a/test (git)-[master] %

Aha! Maybe it doesn't require it at all! Maybe it takes the current path as the source. Nope - failed:

m2a
ERROR
The archive directory "C:\Users\USER\archive" is not a directory!

You omitted the command you were using here. I can't comment on that.

Wait, so do I have to create the archive folder myself?

As the help screen shows, you don't have to create an archivepath yourself if you re-use an existing one:

  --archivepath=DIR     overwrite the default archive base directory which
                        contains one subdirectory per year. DEFAULT is
                        currently "/home/vk/archive/events_memories" (which
                        can be modified in "/home/vk/bin/m2a")

And m2a explains where to modify this script if you want to manually override the default archivepath so that you don't have to use the --archivepath parameter every time. Such changes will get overwritten on every upgrade if you're using pip. That's kind of a hack and could be improved by using a general configuration file such as ~/.config/move2archove.conf which is not implemented yet.

Let's try that and see what changes.

m2a
m2a: error: Please add at least one file name as argument

If you call the script without any parameter at all, what would you expect to happen?

Ahhh, but at least archive is now created. Ok, it works by giving it specific files. Okay. Let's try:

m2a *png --archivepath="C:\archive"
ERROR    File/Folder "*png" does not exist! Aborting.

Still nope!

Again: if you try to file non-existing files, Windows should complain, not the script. As far as I remember how Windows works, you should use "*.png" instead of "*png". I guess this is a general "how to use shell parameters" issue with Windows and not a move2archive-specific issue here.

I checked that at least one PNG file exists in C:\Users\USER\Downloads\ namely: 2022-12-14T14.42.36 pan tadeusz oversimplified -- book ai.png. I try to invoke:

m2a *png --archivepath="C:\archive"
ERROR    File/Folder "*png" does not exist! Aborting.

Again: I guess you have to use "*.png" instead on Windows. On all other operating systems as well in the Windows Subsystem for Linux, "*png" should work but not with Windows command shells.

Fuuuu...., well I surrender. Just as a test - let's give it one specific file and cross my fingers.

m2a "C:\Users\USER\Downloads>m2a "2022-12-14T14.42.36 pan tadeusz oversimplified -- book ai.png" --archivepath="C:\archive"

ERROR    Folder for year "C:\archive\2022" does not exist! Aborting.

Oh my god...

So this was the first invocation with existing files according to the usage provided in the first lines of the help screen.

Sorry, but you're run into many issues related to "how script may be called in a Windows shell".

You gave up right where move2archive actually was invoked correctly for the first time. And it tells you exactly what's the issue at hand: there is no folder C:\archive\2022. So far, move2archive does not create the yearly archive folders for each year by itself. So after creating this archive folder, you should be able to use move2archive as described in the documentation.

So please check back and if you're running in any error which can not be explained by general shell invocation issues or the m2a readme, please report back here.

Besides: there is not move2archive.exe. It's written in a script language called Python. Therefore, it runs on all platforms that do provide a Python environment. If I would have made an exe, it would be a Windows-only tool. I don't run Windows, I don't have access to Windows and so I prefer writing tools to be not specific to one operating system only.

From the looks of it and assuming that my assumptions above are correct, I don't see much improvement potential of the documentation for now. If you do have an idea how to improve move2archive-related documentation, you're welcome to provide some input here.

Thank you for reporting back your experience so far!

from move2archive.

novoid avatar novoid commented on June 14, 2024

With #7 the archive folder for the current year will be created automatically.

from move2archive.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.