Transfer hidden files / dotfiles with sftp-deploy
Asked by Ralph Bolliger:

**Hello there community!**

I am not able to get hidden files/dotfiles, or more specifically the .htaccess file, transferred over SFTP with the sftp-deploy:0.5.7 pipe.

My current script is this:

```
pipelines:
  branches:
    "develop":
      - step:
          name: Create staging build
          caches:
            - node
          script:
            - yarn
            - yarn build
          artifacts:
            - build/**
      - step:
          name: Deploy to staging environment on --stripped-- ($STAGING_SERVER)
          deployment: staging
          script:
            - pipe: atlassian/sftp-deploy:0.5.7
              variables:
                SERVER: $STAGING_SERVER
                USER: $STAGING_USER
                PASSWORD: $STAGING_PASSWORD
                REMOTE_PATH: "/httpdocs/--stripped--/"
                LOCAL_PATH: "build/*"
                EXTRA_ARGS: "-r -P 2121"
                DEBUG: "true"
```

The .htaccess file is present in the artifacts tar.gz file downloaded from the pipe after completing the first step. But it doesn't get transferred in the second step.

I also tried different approaches (globs) on the LOCAL_PATH variable, including single and double asterisks. I also passed the -r flag in EXTRA_ARGS... but it doesn't work.

Does anybody know a solid solution to this?

Greetings \& a happy new year!

Ralph


Answers:
author: Halyna Berezovska
body: [@Ralph Bolliger](/t5/user/viewprofilepage/user-id/657368) Thanks for using the pipe.

Following basic steps , I didn't succeed to reproduce your issue.

I have deployed through sftp-deploy pipe folder with hidden files and tried to run yarn build - it says there is no such command.

Perhaps, you meant \`yarn install\` or some plugins should be installed?

Also, I'd like to get the problem more precisely: are you looking for .htaccess file in tar.gz and then you look for .htaccess file or .tar.gz file on the server?

Svftp-deploy pipe only deploys files to server without unpacking.

Regards, Galyna

comments: author: Ralph Bolliger
body: Hi Galyna

Hmm. I've to try this again with the next deployment. But:

The whole pipeline works fine **but** the .htaccess file on artifact root doesn't get tranferred even it's present in the artifact from step named \>\>*Create staging build*\<\<.

Would it be helpful to paste the log output from the pipline after next run here?

Greetings

Ralph


author: Halyna Berezovska
body: [@Ralph Bolliger](/t5/user/viewprofilepage/user-id/657368)yes, sure , the logmay always be helpful.

I will try to reproduce this again.

Perhaps, I have missed something. For example, I have just noticed, you use unusual name of remote dir \`--stripped--\`.


author: Ralph Bolliger
body: Hi Galyna, the directory is actually not called *--stripped--* . I replaced the name with *--stripped--* in order not to make names public here.


author: Halyna Berezovska
body: [@Ralph Bolliger](/t5/user/viewprofilepage/user-id/657368)I managed to reproduce your problem and fix it.

So, try not build/\* , but build/ in the variable LOCAL_PATH , with same EXTRA_ARGS.

The thing is build/\* gives you all not hidden files

Regards, Galyna


author: Ralph Bolliger
body: Hi Galyna, thank you for coming back to me.

I changed the pipeline configuration and managed to transfer the hidden files (.htaccess) to the remote server.

Unfortunately the change from build/\* to build/ creates a directory called build/ on remote root. But I simply changed the web server configuration in order to serve the application from the new build/ directory.

This works for now.

Greetings, Ralph


author: rogiervancann
body: I also have this issue but won't accept that the files are transferred to an additional directory.

How to transfer files, including hidden files, from dist?


author: Halyna Berezovska
body: [@rogiervancann](/t5/user/viewprofilepage/user-id/4133898) you could use

```
LOCAL_PATH: "your-dir/."
```

Regards, Galyna


Tags: bitbucket-pipelines

cloud

sftp