# Need a script to collect file names from my Cloud Drive

**URL:** <https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262>\
**Category:** Factual Questions\
**Created:** [July 1, 2022, 6:32pm UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262 "2022-07-01T18:32:16Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![aceplace57](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/aceplace57/32/3500_2.png) [@aceplace57](https://boards.straightdope.com/u/aceplace57)\
**Post date:** [July 1, 2022, 6:32pm UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262/1 "2022-07-01T18:32:16Z")

</div>

Drive (google app) lists folders grouped together separate from zip files.

I’m going crazy having to manually type a list of file names and Sort in a spreadsheet. It took over an hour for 35 files. Keying in data on a phone is so painfil and error prone.

Could a Script pull the file names and sort?

Amazon already has that ability. I extracted book titles and author from my moms kindle library. Created a access database that I could print for her. I could tell her all the books she had by a specific author. Very helpful because she’s bought over 350 kindle books in the past 10 years.

Or maybe I need to purchase space on dropbox? I can’t use syncing because my phone doesn’t have the space for duplicates of my files. I download what I need, use it, and eventually delete off the phone.

---

<div class="post-metadata">

**Author:** ![MindsEye\_Watering](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/mindseye_watering/32/3619_2.png) [@MindsEye\_Watering](https://boards.straightdope.com/u/MindsEye_Watering)\
**Post date:** [July 1, 2022, 6:44pm UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262/2 "2022-07-01T18:44:28Z")

</div>

Not a script, but a procedure to extract file names from a collection of files. This is for Windows - I don’t think this applies to smartphones:

1. Select contents of folder
2. Shift-Right click on contents and “Copy as path”
3. Paste into target document
4. “Find and Replace” unwanted path text – Replace with blank.

---

<div class="post-metadata">

**Author:** ![gnoitall](https://avatars.discourse-cdn.com/v4/letter/g/bb73d2/32.png) [@gnoitall](https://boards.straightdope.com/u/gnoitall)\
**Post date:** [July 1, 2022, 6:58pm UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262/3 "2022-07-01T18:58:18Z")

</div>

> [@aceplace57](#):
>
> data on a phone
> 
> Could a Script pull the file names and sort?

What scripting language do you think you have available on a phone? (What phone OS is this on?)

@MindsEye_Watering outlined a general method if you install a Google Drive client on your PC, since scripting options are plentiful. But without some specialist tooling, I don’t know of any options to programmatically acquire or manipulate a list of the contents of a Google Drive.

---

<div class="post-metadata">

**Author:** ![EinsteinsHund](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/einsteinshund/32/8400_2.png) [@EinsteinsHund](https://boards.straightdope.com/u/EinsteinsHund)\
**Post date:** [July 1, 2022, 7:07pm UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262/4 "2022-07-01T19:07:50Z")

</div>

> [@MindsEye\_Watering](#):
>
> Not a script, but a procedure to extract file names from a collection of files. This is for Windows - I don’t think this applies to smartphones:
> 
> 1. Select contents of folder
> 2. Shift-Right click on contents and “Copy as path”
> 3. Paste into target document
> 4. “Find and Replace” unwanted path text – Replace with blank.

Or alternatively, you can open a cdm window in the Google Drive folder and type in “dir /b _._ \>filenames.txt”. This creates a list of the bare filenames in the text file filenames.txt. Skips the “Find and Replace” step.

---

<div class="post-metadata">

**Author:** ![aceplace57](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/aceplace57/32/3500_2.png) [@aceplace57](https://boards.straightdope.com/u/aceplace57)\
**Post date:** [July 1, 2022, 7:11pm UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262/5 "2022-07-01T19:11:59Z")

</div>

It’s Android.

I was concerned that I might need a different cloud drive. Apps can read Google drive. X-explore will open it, list files, and copy/move. He may be using google tools in that App. You still get the same list grouped by folder and another goup of zip files. I deeply regret ever uploading those folders. I should have kept them in the original container.

I’ll look at some other cloud drives and see if they’ll extract file names into a text file.

I also dust off my laptop. Trying doing whst I need in Windows.

---

<div class="post-metadata">

**Author:** ![aceplace57](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/aceplace57/32/3500_2.png) [@aceplace57](https://boards.straightdope.com/u/aceplace57)\
**Post date:** [July 1, 2022, 7:27pm UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262/6 "2022-07-01T19:27:19Z")

</div>

> [@EinsteinsHund](#):
>
> alternatively, you can open a cdm window in the Google Drive folder and type in “dir /b _._ \>filenames.txt”. This creates a list of the bare filenames in the text file filenames.txt. Skips the “Find and Replace” step.

That sounds like my best option. I’ll try it this weekend. Thanks

---

<div class="post-metadata">

**Author:** ![echoreply](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/echoreply/32/3641_2.png) [@echoreply](https://boards.straightdope.com/u/echoreply)\
**Post date:** [July 1, 2022, 7:33pm UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262/7 "2022-07-01T19:33:33Z")

</div>

Look for a program called `rclone`. It is a free and open source command line program that can do lots of manipulations on cloud storage. Once you give it access to your Google drive, it will be able to do things like list all of the files. It isn’t going to solve your problem, but it may be a key ingredient in any script or process that solves it.

Like with all versatile command line tools, `rclone` has a ton of options, because with great power comes great complexity.

---

<div class="post-metadata">

**Author:** ![EinsteinsHund](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/einsteinshund/32/8400_2.png) [@EinsteinsHund](https://boards.straightdope.com/u/EinsteinsHund)\
**Post date:** [July 1, 2022, 8:08pm UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262/8 "2022-07-01T20:08:14Z")

</div>

> [@aceplace57](#):
>
> > [@EinsteinsHund](#):
> >
> > alternatively, you can open a cdm window in the Google Drive folder and type in “dir /b _._ \>filenames.txt”. This creates a list of the bare filenames in the text file filenames.txt. Skips the “Find and Replace” step.
> 
> That sounds like my best option. I’ll try it this weekend. Thanks

I see now in your quote that discourse ate up a crucial part of the dir command in my first post, so here’s the proper command in a code box:

```auto
dir /b *.* >filenames.txt
```

---

<div class="post-metadata">

**Author:** ![aceplace57](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/aceplace57/32/3500_2.png) [@aceplace57](https://boards.straightdope.com/u/aceplace57)\
**Post date:** [July 1, 2022, 8:26pm UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262/9 "2022-07-01T20:26:20Z")

</div>

IIRC there’s a sort option too?

I can always import into a spreadsheet and sort if needed.

---

<div class="post-metadata">

**Author:** ![EinsteinsHund](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/einsteinshund/32/8400_2.png) [@EinsteinsHund](https://boards.straightdope.com/u/EinsteinsHund)\
**Post date:** [July 1, 2022, 8:38pm UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262/10 "2022-07-01T20:38:41Z")

</div>

As you say, there’s a sort option for the “dir” command, though I don’t remember it and had to look it up. But I think without it, the list is sorted alphabetically, and as you also say, it might be easier anyway to sort it in the order you like in a spreadsheet or database application after export.

---

<div class="post-metadata">

**Author:** ![aceplace57](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/aceplace57/32/3500_2.png) [@aceplace57](https://boards.straightdope.com/u/aceplace57)\
**Post date:** [July 1, 2022, 8:40pm UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262/11 "2022-07-01T20:40:26Z")

</div>

I love The Dope. Always get great answers to questions. Thanks

I’m going to take this a step further. Create a song database of my purchased lessons. Setup query screens to list by artist or song. Include any short notes I’ve made about playing the song. I play songs for awhile and move on to others. I eventually get rusty on the old material.

Getting the data is always step 1. I can do that now.

---

<div class="post-metadata">

**Author:** ![md-2000](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@md-2000](https://boards.straightdope.com/u/md-2000)\
**Post date:** [July 2, 2022, 5:58am UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262/12 "2022-07-02T05:58:19Z")

</div>

> [@EinsteinsHund](#):
>
> > [@aceplace57](#):
> >
> > > [@EinsteinsHund](#):
> > >
> > > alternatively, you can open a cdm window in the Google Drive folder and type in “dir /b _._ \>filenames.txt”. This creates a list of the bare filenames in the text file filenames.txt. Skips the “Find and Replace” step.
> > 
> > That sounds like my best option. I’ll try it this weekend. Thanks
> 
> I see now in your quote that discourse ate up a crucial part of the dir command in my first post, so here’s the proper command in a code box:
> 
> ```auto
> dir /b *.* >filenames.txt
> 
> ```

The command to do a directory listing of the entire tree, not just one directory:

add /s to the command. Such as…

DIR C:\USERS\ME\DOCUMENTS /S /B (or whatever folder you want to list) The example givenr by hund will put filenames.txt in the current working directory.

If you want to know all the options, DIR /?

---

<div class="post-metadata">

**Author:** ![EinsteinsHund](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/einsteinshund/32/8400_2.png) [@EinsteinsHund](https://boards.straightdope.com/u/EinsteinsHund)\
**Post date:** [July 2, 2022, 9:20am UTC](https://boards.straightdope.com/t/need-a-script-to-collect-file-names-from-my-cloud-drive/967262/13 "2022-07-02T09:20:12Z")

</div>

Thanks for the correction. I didn’t remember the /s switch and that the “\*.\*” part is superfluous. My old DOS skills are very rusty…
