organize icon indicating copy to clipboard operation
organize copied to clipboard

Winerror when trying to exclude specific files in folder

Open TheCrazyMax opened this issue 3 years ago • 2 comments

Hello, I wrote this rule: image

And I am getting this error when running organize sim: image

In the logs I have that: 2021-04-07 20:13:51,169 - organize - ERROR - [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\Users\\mma\\Downloads\\*Netflix*.csv' Traceback (most recent call last): File "c:\users\mma\appdata\local\programs\python\python37\lib\site-packages\organize\cli.py", line 77, in main execute_rules(config.rules, simulate=args["sim"]) File "c:\users\mma\appdata\local\programs\python\python37\lib\site-packages\organize\core.py", line 92, in execute_rules failed, succeded = run_jobs(jobs=jobs, simulate=simulate) File "c:\users\mma\appdata\local\programs\python\python37\lib\site-packages\organize\core.py", line 154, in run_jobs for job in sorted(jobs, key=lambda x: (x.folderstr, x.basedir, x.path)): File "c:\users\mma\appdata\local\programs\python\python37\lib\site-packages\organize\core.py", line 105, in create_jobs for folderstr, basedir, path in all_files_for_rule(rule): File "c:\users\mma\appdata\local\programs\python\python37\lib\site-packages\organize\core.py", line 124, in all_files_for_rule basedir, globstr = splitglob(folderstr.lstrip("!").strip()) File "c:\users\mma\appdata\local\programs\python\python37\lib\site-packages\organize\utils.py", line 14, in splitglob path = fullpath(globstr.strip()) File "c:\users\mma\appdata\local\programs\python\python37\lib\site-packages\organize\utils.py", line 24, in fullpath return Path(os.path.expandvars(str(path))).expanduser().resolve(strict=False) File "c:\users\mma\appdata\local\programs\python\python37\lib\pathlib.py", line 1144, in resolve s = self._flavour.resolve(self, strict=strict) File "c:\users\mma\appdata\local\programs\python\python37\lib\pathlib.py", line 201, in resolve s = self._ext_to_normal(_getfinalpathname(s)) OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'C:\\Users\\mma\\Downloads\\*Netflix*.csv'

Seeing that in the documentation image I should be able to exclude files with wildcards after adding them.

TheCrazyMax avatar Apr 07 '21 18:04 TheCrazyMax

Hello, there were some problems on windows with the previous versions. Could you please try again with the newly released v2?

tfeldmann avatar Feb 07 '22 17:02 tfeldmann

I should add that the folder exclusion syntax has changed. Please use the new location options or exclude the name with "not":

rules:
  - locations: ~/Downloads
    filters:
      - not name:
          contains: Netflix
      - extension: ["docx", "xlsx", "csv"]
    actions:
      - move: ~/Downloads/Documents

tfeldmann avatar Feb 07 '22 17:02 tfeldmann