-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about 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
azcopy list - show only top level directories #858
Comments
I'd also like to have this feature. Our directories have hundreds of thousands of files in subdirectories, so it makes |
👍🏻 it is weird that I can only list recursively. I just want a quick list at the top level. |
yes, I would like to have this feature. I have a set of subdirectories with a large number of files ( thousands maybe millions ) so the plane azcopy list command becomes very time consuming and difficult to deal with. |
+1 here |
bash workaround... # find top level contents
azcopy ls "https://{store}.blob.core.windows.net/{dir}?SAS" | cut -d/ -f 1 | awk '!a[$0]++'
# find directories with depth N
N=3
azcopy ls "https://{store}.blob.core.windows.net/{dir}?SAS" | cut -d/ -f 1-${N} | awk '!a[$0]++' |
+1 here |
Same here, I sync many thousands of files with azcopy. The workaround to cut the top-level directories works, but is very slow. I recommend an optional parameter like "--depth" to determine the required level. But a parameter "--top-level-only" would also work for me. |
Yes, this is sorely needed... |
+1 |
1 similar comment
+1 |
Please delete "+1" comments and use the "thumbs up" button at the top. Unlike "+1" comments, the latter is usable by both machines and humans. |
This is a work around using python's from azure.storage.blob import BlobServiceClient
from azure.storage.blob import BlobPrefix
# Replace these with your actual connection string and container name
connection_string = "your_connection_string"
container_name = "your_container_name"
# Create a BlobServiceClient
blob_service_client = BlobServiceClient.from_connection_string(connection_string)
# Get a reference to the container
container_client = blob_service_client.get_container_client(container_name)
# List only the top-level directories (virtual directories)
directories = set()
# Use walk_blobs with delimiter="/" to list virtual directories only
for blob in container_client.walk_blobs(name_starts_with='folder/where/you/want/to/ls/', delimiter='/'):
if isinstance(blob, BlobPrefix):
directories.add(blob.name[:-1]) # Remove trailing '/' from the name
# Print the top-level directories
for directory in directories:
print(directory) |
Unfortunately, we are not going to add this functionality. We are focused on documentation, testing, and quality, and this feature would represent a large increase in scope for the product. |
‘Completed’ |
Closed reasons are a relatively new feature: That's probably why they have been barely used: #1 was in 2018 |
Which version of the AzCopy was used?
Note: The version is visible when running AzCopy without any argument
10.3.4
Which platform are you using? (ex: Windows, Mac, Linux)
Windows
What command did you run?
Note: Please remove the SAS to avoid exposing your credentials. If you cannot remember the exact command, please retrieve it from the beginning of the log file.
azcopy list
What problem was encountered?
It shows list of all files recursively, but we want to show only list of directories at the top level.
How can we reproduce the problem in the simplest way?
Have you found a mitigation/solution?
The text was updated successfully, but these errors were encountered: