• About Us
  • Contact Us
  • Advertise
  • Privacy Policy
  • Guest Post
No Result
View All Result
Digital Phablet
  • Home
  • NewsLatest
  • Technology
    • Education Tech
    • Home Tech
    • Office Tech
    • Fintech
    • Digital Marketing
  • Social Media
  • Gaming
  • Smartphones
  • AI
  • Reviews
  • Interesting
  • How To
  • Home
  • NewsLatest
  • Technology
    • Education Tech
    • Home Tech
    • Office Tech
    • Fintech
    • Digital Marketing
  • Social Media
  • Gaming
  • Smartphones
  • AI
  • Reviews
  • Interesting
  • How To
No Result
View All Result
Digital Phablet
No Result
View All Result

Home » AWS CLI: Fixing ‘aws s3 cp’ Directory Exclusions on Windows & VS Code

AWS CLI: Fixing ‘aws s3 cp’ Directory Exclusions on Windows & VS Code

Emily Smith by Emily Smith
September 28, 2025
in How To
Reading Time: 2 mins read
A A
How to Set Up Amazon Q Business with QuickSight Using IAM Federation
ADVERTISEMENT

Select Language:

If you’re trying to copy only specific HTML files from your local folder to an Amazon S3 bucket while excluding the node_modules directory, it can be frustrating when the usual commands don’t work as expected. Here’s a straightforward way to get it done, without including the unwanted directories like node_modules.

ADVERTISEMENT

First, it’s important to understand that including or excluding directories with the aws s3 cp command using wildcards and patterns isn’t always reliable, especially with complex folder structures. Instead of relying solely on exclude and include options, a more precise approach is to perform the copy operation in smaller, controlled steps.

Here’s what you can do:

  1. Use the aws s3 sync command but with specific filters. Although you’ve mentioned that using sync isn’t helpful, this method can give you more control. If you prefer to stay with the cp command, you’ll need to manually specify the files or use a script to target only the files you want.

    ADVERTISEMENT
  2. One effective way is to create a list of all the HTML files that are directly under your main directory, excluding subfolders like node_modules. You can do this using a command line or a simple script in PowerShell.

For example, in PowerShell, run something like:

powershell
Get-ChildItem -Path “C:\Users\15102\Documents\aws\marcab3\s3” -Filter *.html -File | Where-Object { $_.FullName -notmatch “nodemodules” } | ForEach-Object {
$dest = “s3://marcab3/” + $
.Name
aws s3 cp $_.FullName $dest
}

This script searches for all HTML files in your main directory, filters out any files inside the node_modules directory, and uploads only those files.

  1. Make sure your directory structure and file paths are formatted correctly for your operating system and that you’re using the proper quotes and escape characters if needed.

  2. If you’re working with nested directories and only want the HTML files from the main directory (not subfolders), this approach ensures you only upload the files you intend to.

Remember, the key is to avoid trying to exclude directories with complex patterns in the aws s3 cp command because it can become unreliable. Instead, filter your files upfront and upload only those. This method gives you clean control over what gets uploaded.

Hopefully, this solution helps you upload only the desired HTML files while skipping the node_modules folder. If you keep encountering issues, reviewing your directory structure and carefully scripting the file selection will often solve the problem.

ChatGPT ChatGPT Perplexity AI Perplexity Gemini AI Logo Gemini AI Grok AI Logo Grok AI
Google Banner
ADVERTISEMENT
Emily Smith

Emily Smith

Emily is a digital marketer in Austin, Texas. She enjoys gaming, playing guitar, and dreams of traveling to Japan with her golden retriever, Max.

Related Posts

Echoes of IIOJK: The Enduring Fade of Local Music
News

Echoes of IIOJK: The Enduring Fade of Local Music

September 28, 2025
How To

How to Upgrade an HP Pavilion dv7-6b57nr Laptop Safely

September 28, 2025
How to Track Your GitHub Education Benefits After Approval
How To

How to Track Your GitHub Education Benefits After Approval

September 28, 2025
AI

The End of the Era of General Computing! Huang Renxun’s Deep Interview Reveals Why He Invested in OpenAI

September 28, 2025
Next Post

The End of the Era of General Computing! Huang Renxun's Deep Interview Reveals Why He Invested in OpenAI

  • About Us
  • Contact Us
  • Advertise
  • Privacy Policy
  • Guest Post

© 2025 Digital Phablet

No Result
View All Result
  • Home
  • News
  • Technology
    • Education Tech
    • Home Tech
    • Office Tech
    • Fintech
    • Digital Marketing
  • Social Media
  • Gaming
  • Smartphones

© 2025 Digital Phablet