Relocate/Rename folders

Started by er2joe, June 20, 2025, 10:24:11 PM

Previous topic - Next topic

er2joe

I have over 2000 folders named with the pattern, "YYYY-MM-DD description".

I'd like to change them to be, "YYYY.MM.DD description".

I'd rather not do it manually. ChatGPT gave me an app that uses IMatch.relocateFolder, but I can't find that it actually exists.

Is there a function that relocates folders in IMatch? If I use a function that renames the folders, does that update the location in IMatch?

Joe

er2joe

#1
Okay. I found v1/folders/rename. I'm getting error code 1501, failed to rename folder. Here's my call:

        IMWS.post('v1/folders/rename', {
                    path: 'U:\\Users\\pizzijw\\Pictures\\Camera\\2002\\08 - August\\2002-08-23 Around the House', 
                    name: 'U:\\Users\\pizzijw\\Pictures\\Camera\\2002\\08 - August\\2002.08.23 Around the House'
                  }).then(function(response) {
                      if (response.responseJSON) {
                        log(JSON.stringify(response, null, 2))
                      } else {
                        log('No response.')
                      }
                    },
                  function(error) {
                    if (error.responseJSON) {
                      // log(error.responseJSON);
                      log(error.responseText);
                    } else {
                      log('No error')
                    }
                  });

er2joe

Okay. Got past all that.

I'm able to rename all folders except those with commas in the name. Can't get those renamed. Here's one example:
U:\Users\pizzijw\Pictures\Camera\2025\01 - January\2025-01-13 - Manaus, Brazil

cg

It's been my experience in the past with importing attributes from .csv files into IMatch that filenames containing a comma need the comma escaped with a ~ (2025-01-13 - Manaus~, Brazil). That may or may not be the case with the functions you're using. Hope that helps.

er2joe

Thanks for the suggestion, but that didn't work. I still have 
{"parameter":"id/idlist/path","description":"No folder specified or folder does not exist."}


But, a new thing: I have quite a few, "No response from server"

I'm running another program that is maxing out all 24 of my cores, so the no responses could be from that.

Joe

Mario

encodeURI? , is a separator for parameters in an URL you send to IMWS.

er2joe

encodeURI didn't work, either: same error.
I used v1/folders to get the child folders of the folder that contains the folders of interest. Here is the output of one of them:
        {
          "id": 489,
          "ts": 45829.044606,
          "level": 1,
          "parentId": 476,
          "path": "U:\\Users\\pizzijw\\Pictures\\Camera\\2007\\06 - June\\2007.06.24 Ethan~, Joseph & Nicholas on Trampoline\\",
          "name": "2007.06.24 Ethan~, Joseph & Nicholas on Trampoline",
          "friendlyName": "2007-06-24 Ethan, Joseph & Nicholas on Trampoline",
          "mediaId": "248298773",
          "mediaLabel": "DATA",
          "lastUpdate": "2025-06-21T01:04:14",
          "offline": false,
          "description": "",
          "thumbnail": 16922,
          "childrenIds": [],
          "childrenCount": 0,
          "filesCount": 40,
          "filesCountRecursive": 40,
          "filesSize": 152041287,
          "filesSizeRecursive": 152041287,
          "colorCodeSettings": "off",
          "textColor": "",
          "backgroundColor": "",
          "colorCodeSettingsEff": "off",
          "textColorEff": "",
          "backgroundColorEff": ""
        },

Does this give any other ideas? I tried doubling the backslashes, which of course didn't work.

er2joe

I started looking in IMatch, in the Media & Folders. One of the solutions above worked, despite giving an error message.

Seems likely that the quoting worked (~,), since my folders are now named with "~,".  Seems maybe it is only needed in the path, not the name?

Regardless, I have my folders renamed, now.

Thanks for all the help.

Joe