question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to exclude directory and don't create it on server?

See original GitHub issue

Thank you for your really useful work and for the V4!

Bug description I used exclude: scss/** to ignore a folder and the folder is created empty on the server. Reading the scss/** expression this behavior is right. Then how to ignore a folder and don’t create it remotely? I tried exclude: scss/ and this value is ignored (the folder is created and filled).

Thank you.

My Action Config

on: push
name: Publish Website
jobs:
  build-and-deploy:
    name: 🚀 Deploy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: ⚙ Build application
        [...]
      - name: 📂 Sync files
        uses: SamKirkland/FTP-Deploy-Action@4.0.0
        with:
          server: ${{ secrets.FTP_HOST }}
          username: ${{ secrets.FTP_LOGIN }}
          password: ${{ secrets.FTP_PASSWORD }}
          server-dir: www/
          exclude: .git*
            - '**/.git*'
            - .git*/**
            - '**/.git*/**'
            - node_modules/**
            - scss/**
            - package.json
            - package-lock.json
          log-level: verbose

My Action Log

Logs
> Run SamKirkland/FTP-Deploy-Action@4.0.0
with:
server: ***
username: ***
password: ***
server-dir: www/
exclude: .git* - '**/.git*' - .git*/** - '**/.git*/**' - node_modules/** - scss/** - package.json - package-lock.json
log-level: verbose
----------------------------------------------------------------
🚀 Thanks for using ftp-deploy. Let's deploy some stuff!   
----------------------------------------------------------------
If you found this project helpful, please support it
by giving it a ⭐ on Github --> https://github.com/SamKirkland/FTP-Deploy-Action
or add a badge 🏷️ to your projects readme --> https://github.com/SamKirkland/FTP-Deploy-Action#badge
Creating local state at ./.ftp-deploy-sync-state.json
Local state created
Connected to xx.xx.xx.xx:21 (No encryption)
220 This is a private system - No anonymous login

Login security: No encryption
> USER ***
< 331 User *** OK. Password required

> PASS ###
< 230 OK. Current restricted directory is /

> TYPE I
< 200 TYPE is now 8-bit binary

> STRU F
< 200 F OK

> OPTS UTF8 ON
< 200 OK, UTF-8 enabled

> OPTS MLST type;size;modify;unique;unix.mode;unix.owner;unix.group;unix.ownername;unix.groupname;
< 200  MLST OPTS type;size;sizd;modify;UNIX.mode;UNIX.uid;UNIX.gid;unique;

changing dir to www/
> MKD www
< 550 Can't create directory: File exists

> CWD www
< 250 OK. Current directory is /www

dir changed
Trying to find optimal transfer strategy...
> EPSV
< 229 Extended Passive mode OK (|||10157|)

Optimal transfer strategy found.
> RETR .ftp-deploy-sync-state.json
< 550 Can't open .ftp-deploy-sync-state.json: No such file or directory

----------------------------------------------------------------
No file exists on the server "www/.ftp-deploy-sync-state.json" - this much be your first publish! 🎉
The first publish will take a while... but once the initial sync is done only differences are published!
If you get this message and its NOT your first publish, something is wrong.
----------------------------------------------------------------
Local Files:	4
Server Files:	4
----------------------------------------------------------------
Calculating differences between client & server
----------------------------------------------------------------
📁 Create: css
➕ Upload: css/styles.css
📁 Create: node_modules
📁 Create: scss
----------------------------------------------------------------
Making changes to 4 files to sync server state
Uploading: 16 B -- Deleting: 0 B -- Replacing: 0 B
----------------------------------------------------------------
creating folder "css/"
changing dir to css
> MKD css
< 257 "css" : The directory was successfully created

> CWD css
< 250 OK. Current directory is /www/css

dir changed
> CDUP
< 250 OK. Current directory is /www

completed
creating folder "node_modules/"
changing dir to node_modules
> MKD node_modules
< 257 "node_modules" : The directory was successfully created

> CWD node_modules
< 250 OK. Current directory is /www/node_modules

dir changed
> CDUP
< 250 OK. Current directory is /www

completed
creating folder "scss/"
changing dir to scss
> MKD scss
< 257 "scss" : The directory was successfully created

> CWD scss
< 250 OK. Current directory is /www/scss

dir changed
> CDUP
< 250 OK. Current directory is /www

completed
uploading "css/styles.css"
> EPSV
< 229 Extended Passive mode OK (|||18786|)

> STOR css/styles.css
< 150 Accepted data connection

Uploading to 51.68.11.208:18786 (No encryption)
upload progress for "css/styles.css". Progress: 0 bytes of 0 bytes
upload progress for "css/styles.css". Progress: 16 bytes of 16 bytes
< 226-File successfully transferred
226 0.093 seconds (measured here), 171.29 bytes per second

file uploaded
----------------------------------------------------------------
🎉 Sync complete. Saving current server state to "www/.ftp-deploy-sync-state.json"
> EPSV
< 229 Extended Passive mode OK (|||27875|)

> STOR .ftp-deploy-sync-state.json
< 150 Accepted data connection

Uploading to 51.68.11.208:27875 (No encryption)
upload progress for ".ftp-deploy-sync-state.json". Progress: 0 bytes of 16 bytes
upload progress for ".ftp-deploy-sync-state.json". Progress: 804 bytes of 820 bytes
< 226-File successfully transferred
226 0.091 seconds (measured here), 8.59 Kbytes per second

----------------------------------------------------------------
Time spent hashing:               306 milliseconds
Time spent connecting to server:  1.1 seconds
Time spent deploying:             1.5 seconds (10.3 B/second)
- changing dirs:                742 milliseconds
- logging:                      164 milliseconds
----------------------------------------------------------------
Total time:                       3.6 seconds
----------------------------------------------------------------

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
JackNUMBERcommented, Dec 9, 2020

You have to exlude both the folder and the files so add both scss and scss/** like this. Same for node_modules:

exclude: '[.git*, .git*/**, **/.git*/**, node_modules, node_modules/**, package.json, package-lock.json, scss, scss/**]'

Yes! Works fine. Thank you.

Anyway @JackNUMBER, package-lock.json is intended to be versioned so you don’t have to exclude it.

It is versioned 😊 I don’t need it on the server 😃

0reactions
adripocommented, Dec 6, 2020

Anyway @JackNUMBER, package-lock.json is intended to be versioned so you don’t have to exclude it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I exclude a directory when using `find`? - Stack Overflow
To exclude multiple directories, OR them between parentheses. And, to exclude directories with a specific name at any level, use the -name primary...
Read more >
How to use Rsync to exclude Files and Directories in Data ...
To do so, create a text file with the name of the files and directories you want to exclude. Then, pass the name...
Read more >
Exclude files and folders from uploading and downloading
and select Local path. and navigate to the folder that you want to exclude. You can also type the path manually, but note...
Read more >
Add an exclusion to Windows Security - Microsoft Support
Select Add an exclusion, and then select from files, folders, file types, or process. A folder exclusion will apply to all subfolders within...
Read more >
Unix zip directory but excluded specific subdirectories (and ...
In Ubuntu Server this commands works for zip a file excluding some folders, but with a little differences: If you wanna zip without...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found